开发者

Tagging in rails with is_taggable

there is an example provided on how to add tags to a model with is_taggable, and it works very nice (working in 5 minutes)

Now, I also need the opposite, show all reco开发者_如何学Pythonrds that are tagged with a certain word.

Something like:

ModelWithTag.find_by_tags "foo"

or

find_all_tagged_with "foo"

Is this possible with is_taggable ?


Yes, you could do the following:

Tag.where(:name => 'english').first.taggings

which would get you the list of all items tagged with 'english'

Cheers,

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜