Posts [ 3 ]

Topic: RESTFUL rails - not sure how to organize my app

Hi,

So say I have an app with products that can be seen by anyone but administered only by admins.So in a non-restful rails app, I'd just go and create a shop controller and an admin controller. Then how I talk to the models from there is up to me. Easy.

Now with restful rails, I don't understand how to organize my app at all. I have this products controller and now some of the methods go to the admin layout and some don't and frankly it's a completely mess after you start adding more functionality than just the basic CRUD.

Re: RESTFUL rails - not sure how to organize my app

Cigaro222 wrote:

Now with restful rails, I don't understand how to organize my app at all. I have this products controller and now some of the methods go to the admin layout and some don't and frankly it's a completely mess after you start adding more functionality than just the basic CRUD.

Create an admin namespace. On our website, we have:

products_controller: index, show

admin/products_controller: index, new, create, edit, update, destroy

It's still restful, dry, whatever. And the admin namespace is protected by a before_filter :admin_required with double check on the input parameters