I want to create some DRY code by inputting a variable key in the where clause in AR
if I have the field
as :email
and val
as 'my@email.com'
how would I write it in Ruby 2 syntax?
with previous syntax I could write
Model.where(field => val)
which would be Model.where(:email => 'my@email.com')
in Ruby 2 the where can be written as Model.where(email: 'my@email.com')
but how would I use the field
variable in this situation?