Reputation: 369
I'm creating a platform where the Admin can manage everything in the system and one of the properties is create articles with the user_id to the another user.
So the question is what is the best way for make this? because I'm working with devise + cancancan + rolify and currently I'm doing something like that:
I have a Admin login and in my layout I have a navbar and in this navbar I have a collection for recover all the user_ids so this when I select one user_id I'm saving in a session but now I would like to use this user_id to create the articles.
But I don't know if is the best way for doing that.
Just need I little orientation with this topic because I was thinking to create a namespace for separate the admin logic but the admin also can create articles with her own id.
Sorry if the question is basic but I feel I little confuse about what is the best way for doing that.
Thanks for your time !
Upvotes: 0
Views: 43
Reputation: 6438
You should have the option for admin to be able to switch to any user, and then create articles as that user.
Check Switch User gem which works with devise.
Upvotes: 1