I've got a User model and Group model. User has_and_belongs_to_many :groups and Group has_and_belongs_to_many :users.
I'd like to use ActiveRecord to query for all users in all groups that a certain user is in. I can get all the groups via @user.groups and manually join together @user.groups.members, eliminating duplicates as I can find (a user may be in multiple groups along with another user but I only want that other user's name once).
But is there a better way to do it?
belongs_to, orhas_and_belongs_to_many, or something else. - Dylan Markow