dtrusty-U6r7FCv0h4VBDgjK7y7TUQ@public.gmane.org
2006-Nov-13 01:30 UTC
How to deal with collections as input to habtm find?
Hi, I have a HABTM data model with two tables: Users and Groups I have a join table: groups_users. I am given a set of group_ids. The SQL that I would like to see generated would read something like this: select distinct id from users join groups_users on users.id=groups_users.user_id where group_id in (1,2,3); How do I construct a find, such that I select the unique user ids belonging to the set of group_ids? Is this possible using ActiveRecord associations? Thanks! David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---