开发者

Using conditions as a hash for joined tables

开发者 https://www.devze.com 2023-03-01 07:19 出处:网络
I am using Rails 2.3.5 and is wondering if it is possible to rewrite this query using conditions as a hash.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号