RolifyCommunity / rolify

Role management library with resource scoping
https://rolifycommunity.github.io/rolify/
MIT License
3.16k stars 404 forks source link

remove_role deleting the role . #470

Closed Ajitkumar-P closed 6 years ago

Ajitkumar-P commented 6 years ago

user.add_rold :admin user.remove_role :admin

deleted the assigned role in the user_role joint table but also delete the role from role table.

M-Dahab commented 4 years ago

I thought I was having this problem. But, turns out I was calling destroy on the Role instance itself. Make sure you are removing the association only by running user.remove_role :x.

arezk84 commented 2 years ago

Set the configuration remove_role_if_empty to false to avoid this scenario