In my application controller I have
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :save_location
def save_location
session[:user_return_to] = request.url unless request.url =~ %r{/}
end
end
...which saves the location so when the user logs in, it returns to that URL. Is it possible to do the same thing when a user signs out?
您可以在ApplicationController上定义Devise的内置after_sign_out_path_for方法,如其Wiki上所述: https : //github.com/plataformatec/devise/wiki/How-To : -Change - the - redirect - path - after - destroying- 会话即退出
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.