plataformatec/devise — Issue #1676: user_root can mask global root route
Author: jaylevitt
Created: 2012-02-23 19:51:00+00:00
State: open

With Rails 3.1.3, Devise 2.0.4, the following routes file:

devise_for :users do
root :to => 'home#index'
end

root :to => 'welcome#index'

will send even the unauthenticated users to `home#index`. Putting the global root first results in the expected behavior (unauthenticated users land at `welcome#index`).

Not sure if this is just a bug or a documentation issue; I added a note to the wiki page, but there is a great deal of conflicting information about resource roots in both the wiki here:

https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in-out

and the RDocs, which still reference rails 2.3 style routes:

https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in-out

Also, the docs should clarify the distinction between `after_sign_in_path` and `signed_in_root_path`. If you can clarify the absolute right way to do it with modern Rails and Devise, I'll happily send a pull request with updated docs..