开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜