Rails Devise Gem , customize the sign_in path


While using devise gem , once the user logs in successfully , by default it gets redirected to the home page set in routes.rb via “root” . To redirect it to different page , add following code in ApplicationController class


def after_sign_in_path_for(resource)
 "/welcome" #your custom page
end

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s