title: grouping controller in subdirectories for nested resources
body: <p>I would like to organize my controllers in subdirectories. Here is an example:</p>
  
  <p>routes.rb:</p>
  
  <pre><code>resources :locations do
    resources :users
  end
  </code></pre>
  
  <p>I would like to put my controller in the appropriate subdirectory:</p>
  
  <pre><code>app/controllers/locations/users_controller.rb
  </code></pre>
  
  <p>and the url would be (standard):</p>
  
  <pre><code>/locations/1/users
  /locations/1/users/new
  /locations/1/users/10/edit
  ...
  </code></pre>
  
  <p>If i had a namespace in my routes I could change my users_controller.rb to</p>
  
  <pre><code>class Locations::UsersController &lt; LocationsController
  end
  </code></pre>
  
  <p>but it does not work with nested resources, instead I get the following error:</p>
  
  <pre><code> Routing Error
   uninitialized constant UsersController
  </code></pre>
  
  <h3>Update</h3>
  
  <p>It works if I add:</p>
  
  <pre><code>resources :locations do
    resources :users
  end
  match 'locations/:location_id/users' =&gt; "locations/users#index"
  </code></pre>
  
  <p>but I would have to add a route for every action and nested resource...</p>