Answer the question
In order to leave comments, you need to log in
Rails: how to properly separate the functionality of different user roles?
Hello
There are 4 user roles in the system (devise+cancan). Now the check for the role occurs in the controllers and in the views, but this was a temporary and definitely not the right decision. At the moment, you need to enter another user role. So I decided to redo the process. So far, I think the solution is checking for a role in application_contoller and assigning a specific namescape. Could you tell me if this option is not quite right for this situation and is there a better solution?
Update: Ideally, the address should not be affected by namescape at all. So that in the address bar for all user roles everything is the same. The question is how when to do so that, depending on the role of the user, a certain namespace is assigned (I don’t even know how to say it correctly).
Answer the question
In order to leave comments, you need to log in
In what situation? When does validation happen in controllers and views? Then check somewhere in the models or lib folder.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question