title: Rails 3.2.9 Routes to incorrect controller
body: <p>I am using devise and cancan in my app. Both are working. </p>
  
  <p>I have a <code>User</code> model and I have just added <em>(using scaffolding)</em> a new model called <code>Purchase</code>. </p>
  
  <p>Before the Purchase model was added i also have a dashboard controller <em>(which just shows a single page at the moment, <code>dashboard#show</code>)</em> and is the page that gets loaded after login  at <code>localhost:3000/dashboard</code></p>
  
  <p>When a user is not logged in, i can access <code>localhost:3000/purchases</code>. But when the user is logged in I cannot. I can access <code>purchase/1</code> but not <code>/purchases</code>.</p>
  
  <p>Any idea what is going on here?  The error it gives me is  </p>
  
  <blockquote>
    <p>"No route matches {:action=>"show", :controller=>"dashboard"}"</p>
  </blockquote>
  
  <p><strong>Dashboard Controller</strong></p>
  
  <pre><code>class DashboardController &lt; ApplicationController
      def show
          @user = User.find(params[:id])
          authorize! :read, @user
      end
  
  end
  </code></pre>
  
  <p><strong>Routes.rb</strong></p>
  
  <pre><code>App::Application.routes.draw do
    root :to =&gt; 'static_pages#index'
    match '/about', :to =&gt; 'static_pages#about'
    match '/error', :to =&gt; 'static_pages#error'
    devise_for :users
  
    resources :users
  
    resources :dashboard
  
    resource :visitors, :only =&gt; :create # POST to visitor_path to create a visitor
  
    resources :purchases
  </code></pre>
  
  <blockquote>
    <p>Rake Route</p>
  </blockquote>
  
  <pre><code>                    root        /                              static_pages#index
                     about        /about(.:format)               static_pages#about
                     error        /error(.:format)               static_pages#error
          new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
              user_session POST   /users/sign_in(.:format)       devise/sessions#create
      destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
             user_password POST   /users/password(.:format)      devise/passwords#create
         new_user_password GET    /users/password/new(.:format)  devise/passwords#new
        edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                           PUT    /users/password(.:format)      devise/passwords#update
  cancel_user_registration GET    /users/cancel(.:format)        devise/registrations#cancel
         user_registration POST   /users(.:format)               devise/registrations#create
     new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new
    edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit
                           PUT    /users(.:format)               devise/registrations#update
                           DELETE /users(.:format)               devise/registrations#destroy
                     users GET    /users(.:format)               users#index
                           POST   /users(.:format)               users#create
                  new_user GET    /users/new(.:format)           users#new
                 edit_user GET    /users/:id/edit(.:format)      users#edit
                      user GET    /users/:id(.:format)           users#show
                           PUT    /users/:id(.:format)           users#update
                           DELETE /users/:id(.:format)           users#destroy
           dashboard_index GET    /dashboard(.:format)           dashboard#index
                           POST   /dashboard(.:format)           dashboard#create
             new_dashboard GET    /dashboard/new(.:format)       dashboard#new
            edit_dashboard GET    /dashboard/:id/edit(.:format)  dashboard#edit
                 dashboard GET    /dashboard/:id(.:format)       dashboard#show
                           PUT    /dashboard/:id(.:format)       dashboard#update
                           DELETE /dashboard/:id(.:format)       dashboard#destroy
                  visitors POST   /visitors(.:format)            visitors#create
                 purchases GET    /purchases(.:format)           purchases#index
                           POST   /purchases(.:format)           purchases#create
              new_purchase GET    /purchases/new(.:format)       purchases#new
             edit_purchase GET    /purchases/:id/edit(.:format)  purchases#edit
                  purchase GET    /purchases/:id(.:format)       purchases#show
                           PUT    /purchases/:id(.:format)       purchases#update
                           DELETE /purchases/:id(.:format)       purchases#destroy
  </code></pre>