PanosJee wrote:> Hi everyone I want to have two restful controllers for the same
> resource (Users)
> One controller (UsersController) is straight in the controllers folder
> and is used for singup and so on
> Then i need another controller for users which is inside an admin
> folder (Admin::UsersController)
Take a look at the following:
http://guides.rubyonrails.org/routing.html#namespaced-resources
Example:
map.resources :users
map.namespace :admin do |admin|
admin.resources :users
end
$ rake routes
users GET /users(.:format)
{:action=>"index", :controller=>"users"}
POST /users(.:format)
{:action=>"create", :controller=>"users"}
new_user GET /users/new(.:format)
{:action=>"new",
:controller=>"users"}
edit_user GET /users/:id/edit(.:format)
{:action=>"edit",
:controller=>"users"}
user GET /users/:id(.:format)
{:action=>"show",
:controller=>"users"}
PUT /users/:id(.:format)
{:action=>"update", :controller=>"users"}
DELETE /users/:id(.:format)
{:action=>"destroy", :controller=>"users"}
admin_users GET /admin/users(.:format)
{:action=>"index", :controller=>"admin/users"}
POST /admin/users(.:format)
{:action=>"create", :controller=>"admin/users"}
new_admin_user GET /admin/users/new(.:format)
{:action=>"new",
:controller=>"admin/users"}
edit_admin_user GET /admin/users/:id/edit(.:format)
{:action=>"edit",
:controller=>"admin/users"}
admin_user GET /admin/users/:id(.:format)
{:action=>"show",
:controller=>"admin/users"}
PUT /admin/users/:id(.:format)
{:action=>"update", :controller=>"admin/users"}
DELETE /admin/users/:id(.:format)
{:action=>"destroy", :controller=>"admin/users"}
--
Posted via http://www.ruby-forum.com/.