Is it possible to not repeat Rails ActiveRecord where condition arguments? Is it possible to not repeat Rails ActiveRecord where condition arguments? ruby-on-rails ruby-on-rails

Is it possible to not repeat Rails ActiveRecord where condition arguments?


Yes, just use a hash instead of repeat variables.

Things.where('blahs.foo_id = :user_id OR bar_id = :user_id', :user_id => user.id)