title: How to remove controller names from rails routes?
body: <p>I would like to trim down the routes on my application so that:</p>
  
  <p><code>http://myapplication.com/users/peter/questions/how-do-i-create-urls</code></p>
  
  <p>becomes...</p>
  
  <p><code>http://myapplication.com/peter/how-do-i-create-urls</code></p>
  
  <p>I have a users controller and would like it to be resourceful. Users also have a nested resource called questions.</p>
  
  <p><strong>Basic routes file</strong></p>
  
  <p>Without any URL trimming, the routes file looks like this:</p>
  
  <pre><code>...
  resources :users do
    resources :questions
  end
  </code></pre>
  
  <p>However the URLs from this take the form of  </p>
  
  <p><code>http://myapplication.com/users/peter/questions/how-do-i-create-urls</code></p>
  
  <p>rather than</p>
  
  <p><code>http://myapplication.com/peter/how-do-i-create-urls</code></p>
  
  <p><strong>Partial success</strong>
  I have tried doing the following:</p>
  
  <pre><code>...
  resources :users, :path =&gt; '' do
    resources :questions
  end
  </code></pre>
  
  <p>This works and produces: </p>
  
  <p><code>http://myapplication.com/peter/questions/how-do-i-create-urls</code></p>
  
  <p>However if I try:</p>
  
  <pre><code>...
  resources :users, :path =&gt; '' do
    resources :questions, :path =&gt; ''
  end
  </code></pre>
  
  <p>Then things start to go wrong. </p>
  
  <p>Is this the right approach and if so, can it be made to work with nested resources too?</p>