我有一个用于记录的模式窗口。当我按下提交时,我正在记录,但手动重新加载页面后我可以看到结果
我打开函数 after_sign_in_path_for(resource) 并添加行redirect_to root_path 并返回 true
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_action :configure_devise_permitted_parameters, if:
:devise_controller?
before_action :set_referral_cookie
before_action :blog_redirect
force_ssl unless: :ssl_configured?
# skip_before_action :verify_authenticity_token
before_action :redirect_logins
def redirect_logins
if request.fullpath.match('users/sign_in') && request.get?
redirect_to '/?sign_in=true'
end
end
def after_sign_in_path_for(resource)
redirect_to root_path
'/'
end
def ssl_configured?
puts request.original_url
Rails.env.development? || !!request.original_url.match('/blog')
end
def blog
redirect_to "https://www.xxx.xx/blog#{request.fullpath.gsub('/blog','')}", :status => :moved_permanently
end …Run Code Online (Sandbox Code Playgroud)