Topic: Best way to architect separate admin/public views of a single model?

I'm creating a CMS that allows authors to log-in, create new articles, view them, save them, edit them, etc. The way that it's set up, the author's view of the articles (both in :show and :index) will be completely different than how the general public sees them on the live site.

Because the display is so different, I can't use a technique like Ryan Bates shows in Where Administration Goes, and I also can't just use the same views for both authors and regular users.

I know I'm shooting for urls like /articles and /articles/:id for the general public, and I don't particularly care what the urls are in the admin, but do I just use the default REST actions in the articles controller, and detect whether or not someone is logged in to display different views? Do I add additional actions to the controller? Or should there be an entirely different controller that handles all the CRUD, and then an articles controller with only an index and show action? Or some other way that I'm not even thinking of? What's the Rails way to handle this? Amazingly, I couldn't find an answer in the 10 Rails books I own...

I just know I want to use something that I can code myself, instead of going the route of using a gem like Active Admin.

Thanks in advance!
--Mark

Last edited by bigwheeler (2011-10-17 22:41:16)

Re: Best way to architect separate admin/public views of a single model?

Hi, Check out http://railscasts.com/episodes/284-active-admin

If you create a new rails app with scaffild generated models and then use active-admin you will see how it seperates and creates a back end interface.