Rails 3.0.9 + Ruby 1.9.2 p180 + Devise – Routes-Collection of common programming errors

I’m using Rails 3.0.9 + Ruby 1.9.2 p180 + Devise, and here’s my routes:

[...]
devise_for :users,:controllers => { :sessions => "users/sessions" }
[...]
root :to => "users/sessions#new"

I basically wanted to make the devise login page my root route… But when I try to it my local server (http://localhost:3000), I get the following error:

Unknown action

Could not find devise mapping for path "/". Maybe you forgot to wrap your route inside
the scope block? For example: devise_scope :user do match "/some/route" => 
"some_devise_controller" end
  1. Try this:

    devise_scope :user do 
      root :to => "users/sessions#new"
    end
    

    Edit: if you were using devise’s default controllers then you would do this:

    devise_scope :user do 
      root :to => "devise/sessions#new"
    end
    

Originally posted 2013-11-09 21:43:24.