开发者

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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜