I would like to organize my controllers in subdirectories. Here is an example:

routes.rb:

resources :locations do
  resources :users
end

I would like to put my controller in the appropriate subdirectory:

app/controllers/locations/users_controller.rb

and the url would be (standard):

/locations/1/users
/locations/1/users/new
/locations/1/users/10/edit
...

If i had a namespace in my routes I could change my users_controller.rb to

class Locations::UsersController < LocationsController
end

but it does not work with nested resources, instead I get the following error:

 Routing Error
 uninitialized constant UsersController

Update

It works if I add:

resources :locations do
  resources :users
end
match 'locations/:location_id/users' => "locations/users#index"

but I would have to add a route for every action and nested resource...

Edit
Report