I\'m trying to do a simple Post/Tags relation in rails 3. Everything working fine except when I want to query the Posts which are related to several tags. Basically I\'d like to
I'm stuck on the same problem. The squeel docuemtnation suggests this is possible. In the Compound Conditions section he lists three ways to do something similar.
Given
names = ['Ernie%', 'Joe%', 'Mary%']
Then you can do
Person.where('name LIKE ? OR name LIKE ? OR name LIKE ?', *names)
or
Person.where((['name LIKE ?'] * names.size).join(' OR '), *names)
or
Person.where{name.like_any names}
The documentation implies we can use AND instead of OR or like_all as opposed to like_any.
However I can't seem to get it to work for a habtm relationship. It keeps giving me undefined method 'call'
for an instance of ActiveRecord.