views:

55

answers:

2

What is the correct Way to structure an admin section in an Rails application? I'm not talking about Auth, but where to put the admin controllers, routing etc.

A: 

I used the Typus plugin a while ago. It's fine for little projects, but for larger apps it can get messy. Also, when your db schema changes it doesn't adapt. I think it's a Rails deficience compared wth Django.

benoror
+1  A: 

Namespaces.

namespace :admin do
  resources :projects
  resources :users
  # ...
end

Generate controllers with rails generate controller admin/projects etc.

(In Rails 2, it's map.namespace :admin do ... end and ./script/generate controller admin/projects.)

August Lilleaas