This page demonstrates the methods that allow you to create a role or a relationship (or all together) or completely destroy a relationship and role together.
That's exactly it annoying:
Destroying the connection and the role itself
Banal example:
There is the role of "admin" and N users. Dole several users the role of "admin":
user = User.find(1) # IDs: 1, 2, 3, 4, 5... user.add_role :admin This method will add a link to the users_roles table.
After some time, it was necessary to remove the "admin" role from one of the users. According to the link above, we are boldly showing:
user = User.find(1) user.remove_role :admin But only this method will remove the role itself and all connections with other users.
How to be?