Using conditions as a hash for joined tables
I am using Rails 2.3.5 and is wondering if it is possible to rewrite this query using conditions as a hash.
开发者_如何学运维joined_deals = Deal.all :joins => :shops
:conditions => ["shops.name = ?", name]
to something like :conditions => {"shops.name" => name}
. Is it possible in Rails 2?
Yes, it is possible in Rails 2.
For more information, refer here: specifying-conditions-on-the-joined-tables
精彩评论