Reputation: 3957
I'm putting a form on the landing page of my app that will let the user login. The problem is that devise does not have a route for "/". I've tried adding the route with the following:
devise_for :pages, :controllers => {:home => 'home'}
but I just don't have it quite right. Does anyone have any hints on this?
Upvotes: 0
Views: 6041
Reputation: 2286
Add the root route to your devise block like so:
devise_scope :users do
root :to => "users#new"
end
Upvotes: 7
Reputation: 1331
From the devise github README:
After signing in a user, confirming the account or updating the password, Devise will look for a scoped root path to redirect. Example: For a :user resource, it will use user_root_path if it exists, otherwise default root_path will be used. This means that you need to set the root inside your routes:
root :to => "home"
You can also overwrite after_sign_in_path_for and after_sign_out_path_for to customize your redirect hooks.
Upvotes: 2