Devise 2 is really awesome! However, I have been trying superhard to get it to redirect to users/:id after sign in.
The default page is root after user successfully sign into the site. However, I want it to go to the users/:id page that is controlled by users_controller.rb. After sign in, I can manually enter localhost:3000/users/1 to go to the user profile page where I can access the user information, so the show controller is working fine.
The key question is how to I get the site to go to localhost:3000/users/1 after user 1 signs in.
I read the devise wikis many times and googled a lot. The simplest way is to override devise by adding in application_controller.rb:
def after_sign_in_path_for(resource)
dashboard_path
end
I guess my question is how to define the dashboard_path? What do I add in config/routes.rb and in application_controller.rb?
Any help is greatly appreciated! I am using devise 2.0 and rails 3.2.3
First see this link
I tell you what I do
routes.rb
Then declare following helpers in your helper.rb file when you use devise keywords
UsersHelper
Application_controller.rb
I hope this would help you.
Thanks.