Replacing a "has many through" collection


Hi, given a data model like this:

membership belongs_to user
membership belongs_go group

user has_many memberships
user has_many groups through memberships

group has_many memberships
group has_many users through memberships

What’s the most elegant way of setting a new collection of users as
members in a group? Anything better than:

group.users << my_new_users

In a normal has_many relationship, you can do group.users =
my_new_users, but that doesn’t “go through”.