I am currently writing a new rails application and am somewhat confused
about how to organize controllers and actions the restful way.
While writing the backend, everything was clear to me. I’ve used
resource scaffolding most of the time, so my controllers do look very
restful right now. Backend actions should only be available to
So the difficult part is the frontend:
Let’s assume I have a model called “Rabbit”. I do have the CRUD-actions
(index, show, new, edit, create, update, destroy) in the backend.
Frontend users should only be able to see rabbits, so I could open up
the show and index actions to them. But the backend and the frontend do
use different layouts. Switching layouts depending on the login status
is also bad, because backend admins should be able to use the frontend
in the same way unregistered users do.
So, what are your recommendations for organizing backend and frontend
actions and controllers? Create a separate controller for the frontend
actions? Create separate actions for show and index in the same
controller? Anything else I may have overlooked?
Any help is appreciated.