I’m using rolify to manage user roles and when I try to update the roles via a user form I receive this:
can't mass-assign protected attributes: role_ids
This is comforting, but it has me wondering, how do I then allow admin to update user roles via mass-assign yet not allow normal users to?
You can use a different
attr_accessiblelist inside yourUsermodel:And then inside the
createandupdateactions for your admin controller: