rails + devise redirect to home after timeout
I am using devise 1.4.0. What开发者_JAVA百科 I need is to configure the url to root after the session has timed out ( instead of redirecting to login). Anybody know how to do this? Thanks
You can override the after_sign_out_path_for
method. Add this method in your ApplicationController
as a private
method:
def after_sign_out_path_for(resource)
root_path
end
Take a look at devise wiki for details.
This is the code which I am using for this purpose.
In application_controller.rb
private
def after_sign_out_path_for(resource_or_scope)
params[:back].nil? ? home_path : params[:back]
end
You want to set up home_path in routes.rb file.This will override the default routing.
精彩评论