In Active Record you can use named bindings in where
-conditions. This helps you to make your code more readable and reduces repetitions in the binding list.
Example without named bindings
User.where(
'name = ? OR email ?',
params[:query],
params[:query]
)
Example with named bindings
User.where(
'name = :query OR email :query',
query: params[:query]
)
Posted by Emanuel to makandra dev (2020-04-27 11:50)