1
votes

I'm getting devise 404 errors on a production server, both for get requests to /users/sign_in and its "link_to" equivalent. If I copy development.rb to production.rb, I get the error:

No route matches {:controller=>"devise/home"}

This:

  • Works on my development box.

  • Doesn't work on the production box using either webbrick or passenger.

All other routes are working OK, but the devise routes are not. I think I've read every stackoverflow and other google-fu link I can find twice, but no luck so far.

"Rake routes" output is below. If I try the route that /users/sign_in GET resolves to, (i.e., devise/sessions#new), I get the error: No route matches [GET] "/devise/sessions"

None of the following work:

link_to('Login / Register', new_user_session_path) link_to('Login / Regsiter', :controller => "devise/sessions", :action => "new") link_to('Login / Regsiter', :controller => "/devise/sessions", :action => "new") link_to('Login / Register', '/users/sign_up')

I've seen some references to scoping issues, but I'll be darned if that makes any sense to me given the symptoms. I'm completely stumped on this one. Any ideas?

Contents of routes.rb and "rake routes" output follow:

Aprojectx::Application.routes.draw do

  devise_for :users

  match "/people/test" => "people#test"

  resources :people    Aprojectx::Application.routes.draw do

  devise_for :users

  match "/people/test" => "people#test"

  resources :people

  resources :document_versions

  resources :documents

  resources :escrow_roles

  resources :escrows

  resources :tasks

  root :to => 'home#index'
  match "/specification" =>  'home#specification'
  match "/sales" =>  'home#sales'
end

  resources :document_versions
    Aprojectx::Application.routes.draw do

  devise_for :users

  match "/people/test" => "people#test"

  resources :people

  resources :document_versions    Aprojectx::Application.routes.draw do

  devise_for :users

  match "/people/test" => "people#test"

  resources :people

  resources :document_versions

  resources :documents

  resources :escrow_roles

  resources :escrows

  resources :tasks

  root :to => 'home#index'
  match "/specification" =>  'home#specification'
  match "/sales" =>  'home#sales'
end

  resources :documents

  resources :escrow_roles

  resources :escrows

  resources :tasks

  root :to => 'home#index'
  match "/specification" =>  'home#specification'
  match "/sales" =>  'home#sales'
end
  resources :documents

  resources :escrow_roles

  resources :escrows

  resources :tasks

  root :to => 'home#index'
  match "/specification" =>  'home#specification'
  match "/sales" =>  'home#sales'
end



root@escrowmaker:/var/www/apps/aprojectx# rake routes
             people_test        /people/test(.:format)                people#test
                  people GET    /people(.:format)                     people#index
                         POST   /people(.:format)                     people#create
              new_person GET    /people/new(.:format)                 people#new
             edit_person GET    /people/:id/edit(.:format)            people#edit
                  person GET    /people/:id(.:format)                 people#show
                         PUT    /people/:id(.:format)                 people#update
                         DELETE /people/:id(.:format)                 people#destroy
       document_versions GET    /document_versions(.:format)          document_versions#index
                         POST   /document_versions(.:format)          document_versions#create
    new_document_version GET    /document_versions/new(.:format)      document_versions#new
   edit_document_version GET    /document_versions/:id/edit(.:format) document_versions#edit
        document_version GET    /document_versions/:id(.:format)      document_versions#show
                         PUT    /document_versions/:id(.:format)      document_versions#update
                         DELETE /document_versions/:id(.:format)      document_versions#destroy
               documents GET    /documents(.:format)                  documents#index
                         POST   /documents(.:format)                  documents#create
            new_document GET    /documents/new(.:format)              documents#new
           edit_document GET    /documents/:id/edit(.:format)         documents#edit
                document GET    /documents/:id(.:format)              documents#show
                         PUT    /documents/:id(.:format)              documents#update
                         DELETE /documents/:id(.:format)              documents#destroy
            escrow_roles GET    /escrow_roles(.:format)               escrow_roles#index
                         POST   /escrow_roles(.:format)               escrow_roles#create
         new_escrow_role GET    /escrow_roles/new(.:format)           escrow_roles#new
        edit_escrow_role GET    /escrow_roles/:id/edit(.:format)      escrow_roles#edit
             escrow_role GET    /escrow_roles/:id(.:format)           escrow_roles#show
                         PUT    /escrow_roles/:id(.:format)           escrow_roles#update
                         DELETE /escrow_roles/:id(.:format)           escrow_roles#destroy
                 escrows GET    /escrows(.:format)                    escrows#index
                         POST   /escrows(.:format)                    escrows#create
              new_escrow GET    /escrows/new(.:format)                escrows#new
             edit_escrow GET    /escrows/:id/edit(.:format)           escrows#edit
                  escrow GET    /escrows/:id(.:format)                escrows#show
                         PUT    /escrows/:id(.:format)                escrows#update
                         DELETE /escrows/:id(.:format)                escrows#destroy
                   tasks GET    /tasks(.:format)                      tasks#index
                         POST   /tasks(.:format)                      tasks#create
                new_task GET    /tasks/new(.:format)                  tasks#new
               edit_task GET    /tasks/:id/edit(.:format)             tasks#edit
                    task GET    /tasks/:id(.:format)                  tasks#show
                         PUT    /tasks/:id(.:format)                  tasks#update
                         DELETE /tasks/:id(.:format)                  tasks#destroy
                    root        /                                     home#index
           specification        /specification(.:format)              home#specification
                   sales        /sales(.:format)                      home#sales
        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
1
Any answer on this? I have the exact same issue when going to production. Seems like my routes for Devise aren't being followed in production but work fine in devNungster

1 Answers

1
votes

The answer -- turn on config.log_level = :debug in productiono.rb, then work from there. Indeed, I had to add a leading forward slash to controller names starting with "home" in some of my layout partials.