acts_as_taggable_on: query for users tagged with any of these tags
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.
Try this one:
User.tagged_with(tags.map(&:name), :any => true)
Hope it helps!
精彩评论