I there some place that has a good walk through on implementing tagging? Basically, I have a table of things a table of tags. the things have a many-to-many relationship to tags. I can get tags for a thing by thing.tags but i''m at a loss as to how to get things back that are tagged with multiple tags -- ie. if i were writing sql: SELECT thing_id FROM thing JOIN thing_tag AS thing_tag_1 ON (thing.thing_id thing_tag_1.thing_id) JOIN tag AS tag_1 ON (thing_tag_1.tag_id = tag_1.tag_id) JOIN thing_tag AS thing_tag_2 ON (thing.thing_id thing_tag_2.thing_id) JOIN tag AS tag_2 ON (thing_tag_2.tag_id = tag_2.tag_id) WHERE tag_1.tag = ''foo'' AND tag_2.tag = ''bar'' help!! thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, Just use acts_as_taggable, it''s easy and works great. http://wiki.rubyonrails.com/rails/pages/Acts+As+Taggable+Plugin enjoy. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks, Elad. It seems like there''s some question as to whether to use the gem or the plug-in. Any thoughts? FYI, for anyone else dickering around with this sort of thing, I found this helpful: http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html Intersection (AND) Query for "bookmark+webservice+semweb": SELECT b.* FROM scBookmarks b, scCategories c WHERE c.bId = b.bId AND (c.category IN (''bookmark'', ''webservice'', ''semweb'')) GROUP BY b.bId HAVING COUNT( b.bId )=3 the having count() thing is cute. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
toulax-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-18 18:14 UTC
Re: newbie: tags (or habtm) howto?
I currently use the acts_as_taggable plugin because I need to tag stuff on multiple tables and if you use the gem version you need a taggings tables for each one of those tables. So if you need to tag a lot of different I''d go with the plugin, or else the gem which has some goodies built-in like tags cloud. Unfortunately, both seem to be have no more development at all :( On Feb 18, 2:38 pm, "bjung" <bklyn...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks, Elad. It seems like there''s some question as to whether to use > the gem or the plug-in. Any thoughts? > > FYI, for anyone else dickering around with this sort of thing, I found > this helpful:http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html > > Intersection (AND) > Query for "bookmark+webservice+semweb": > SELECT b.* > FROM scBookmarks b, scCategories c > WHERE c.bId = b.bId > AND (c.category IN (''bookmark'', ''webservice'', ''semweb'')) > GROUP BY b.bId > HAVING COUNT( b.bId )=3 > > the having count() thing is cute.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---