Rest, Roles, Layouts

I read an earlier post regarding rest and permissions, however I’m not
sure the answer covers my question.

Let’s use the simple example of a blog application. A standard user has
the ability to view blog entries. An admin has the ability to
add/edit/delete entries. Simple stuff.

What I’m wondering is, what is the best way to structure my controllers
to utilize the least amount of code?

Should I build two controllers, one for the standard user that just
allows viewing of posts and a separate controller for admin purposes.
Should I try to utilize a single controller and place permissions on
different actions?

I realize that the layouts for each role will be different. I also
realize that some actions will only be for some roles. For example: a
standard user won’t be able to post a new entry. However, I also
realized that some actions (ex: index) will be the same for both
controllers. My initial instinct is to create two controllers, but I
would like some feedback from others who have tackled the issue.

Any input would be appreciated.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs