I’m working on a Rails application, and I want to keep things restful
and clean. I’m using the restful_authentication plugin to authenticate
users and I want to keep the administration backend separate from the
frontend. The application manages a list of items, let’s say articles,
which are listed by the index action. The list of articles should be
visible in the frontend as well as in the backend, but frontend and
backend should show a different layout. I could switch the layout based
on the login status to keep things DRY, but this would show the backend
layout even if the client is logged in and wants to see the app from the
user’s point of view. I could simply copy the index action from the
controller and rename it to list, which would even enable me to protect
the list action by restful_authentication and to leave the index action
public. But this approach does not keep things DRY.
Do you have any suggestions?