Reputation: 12273
I have an AR query that looks like this
user.books.joins(:authors).where(:authors => {:id => [1,2,3]}, :title => 'blah')
This is just an example but notice when I specify conditions on the joined table I'm using the pre-1.9 hash syntax. ie. :authors => {:id => [1,2,3]}
Is there a way to do this same query with the 1.9 hash syntax?
It's pretty readable as it is and using the 1.9 syntax will probably make it less so. But I'm still curious if it's possible and what it would look like.
Upvotes: 1
Views: 930
Reputation: 42933
This should perfectly with the the new syntax:
user.books.joins(:authors).where(authors: {id: [1,2,3]}, title: 'blah')
Upvotes: 1