rubyprince
rubyprince

Reputation: 17803

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?

Upvotes: 0

Views: 224

Answers (1)

Jatin Ganhotra
Jatin Ganhotra

Reputation: 7035

Yes, it is possible in Rails 2.

For more information, refer here: specifying-conditions-on-the-joined-tables

Upvotes: 1

Related Questions