Hi, I have a habtm relationship between ''Posts'' and ''Tags'' and am trying to get a list of Posts that have multiple tags. Something like: @posts = Posts.find_posts_with_tag_ids[1, 3, 5] Is this catered for in ActiveRecord or should I write my own SQL statement? Thanks, GiantCranes -- 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 -~----------~----~----~----~------~----~------~--~---
Giant Cranes
2006-Nov-22 11:19 UTC
Re: has_and_belongs_to_many find with multiple predicates?
I found two posts which deal with this and provide two clever solutions: http://blog.hasmanythrough.com/articles/2006/06/12/when-associations-arent-enough http://blog.hasmanythrough.com/articles/2006/06/12/when-associations-arent-enough-part-2 -- 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 -~----------~----~----~----~------~----~------~--~---