views:

31

answers:

1

I'm using acts_as_taggable_on and I'm trying to query for all users tagged with any of the tags in the collection tags

Right now I'm doing:

tags.map(&:name).each { |name| @result.push User.tagged_with(name) }

Is there a way that I can do this in one query, and not tags.size queries? I'd appreciate any help.

+1  A: 

Try this one:

User.tagged_with(tags.map(&:name), :any => true)

Hope it helps!

jpemberthy