title: Ruby on Rails nested resource routing error
body: <p>I have a user, comment, and route model as shown:</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
   has_many :routes, :dependent =&gt; :destroy
   has_many :comments, :dependent =&gt; :destroy
  end
  
  class Route &lt; ActiveRecord::Base
   belongs_to :user
  end
  
  class Comment &lt; ActiveRecord::Base
   belongs_to :user
  end
  </code></pre>
  
  <p>I have the routes.rb file nesting comments and routes within user as shown:</p>
  
  <pre><code>MyApp::Application.routes.draw do
  resources :users do
   resources :comments
   resources :routes
  end
  </code></pre>
  
  <p>When I run 'rake routes', the route to the Routes_controller index appears as so:</p>
  
  <pre><code>user_routes GET /users/:user_id/routes(.:format) {:action =&gt;"index", :controller=&gt;"routes"}
  </code></pre>
  
  <p>Yet for some reason when a user is signing in, I get a routing error saying that the routes controller cannot be found.  This happens when the system is posting a new session in the session controller.  I know that it attempts to sign in the user, but fails on the redirect.  Any suggestions?</p>
  
  <pre><code>class SessionsController &lt; ApplicationController
  ...
  def create
   user = User.authenticate(params[:session][:email],
                           params[:session][:password])
   if user.nil?
    flash.now[:error] = "Invalid email/password combination."
    @title = "Sign in"
    render 'new'
   else
    sign_in user
    redirect_to user_routes_path
   end
   end
  ...
  end
  </code></pre>
  
  <p>For some reason, the stack trace wasn't displayed when I redirect to user_routes_path, so I have it direct to root_path and the same thing happens.  Here is the trace for that:</p>
  
  <pre><code>app/views/layouts/_header.html.erb:3:in
    `_app_views_layouts__header_html_erb___917786942_46449696_315190'
  app/views/layouts/application.html.erb:11:in
    `_app_views_layouts_application_html_erb__423035099_46500948_0'
  </code></pre>