views:

42

answers:

1

I'm setting up a directory application for which I need to have two separate interfaces for the same Users table. Basically, administrators use the Users controller and views to list, edit, and add users, while non-admins need a separate interface which lists users in a completely different manner. To do this, would I be able to just set up another controller with different views but which accesses the Users model?

Sorry if this is a simple question, but I've had a hard time finding how to do this.

+2  A: 

Why not put the admin part into a separate namespace - you would have Admin::UsersController with views in app/views/admin/users/. And your users would go to UsersController with its own views in app/views/users/.

The routing is defined like this:

map.namespace :admin do |admin|
  admin.resources :users
end


map.resources :users

And can be got to via admin_users_path and users_path

neutrino
I had read about namespaces, but I was concerned that using them would conflict with my nested resources. Is that not the case?
Eric K
@Eric: No, that's not the case at all. I'll expand the original answer.
Ryan Bigg