I have a permissions model, with the following fields (id, role_id, group_id, user_id)
Where role_id, 1: admin, 2: member
What I want to create is a link that says “Make Admin” which when click remotely hits the server to update the user to an admin, with JS response allowing me to update the UI. So what’s the best way to do this?
Do I post to my Permission’s controller update controller? Or should I have a separate method for this sole purpose?
Thanks
You should have a separate method for this.
As said, you should
program to the interface and not the implementation.Making a post to Permission’s controller update and make a separate method to call update_attributes does the same thing but essentially, the latter one will server only one purpose.
As I said, program to the interface.