I have the following case: I have two models: UserGroup and User (with a many-to-many relationship). I need to end up with a distinct list of Users.
What I have: A set of ids of UserGroups, and A set of ids of Users.
What I want: A set of distinct list of Users, based upon what I have.
The illustration is a bit misleading, as it only shows that I have UserGroup ids, but I also have some ids of Users.
How can this be done in an elegant way in Ruby on Rails?
Thanks.

Hope it helps you
With this, you can get distinct users only for your selected user_groups