How to deal with collections as input to habtm find?


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

select distinct id from users join groups_users on 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?



This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs