У меня есть модальное окно для ведения журнала.Когда я нажимаю "Отправить", я регистрируюсь, но результат, который я вижу после перезагрузки страницы вручную
Я открываю функцию 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
Вконсоль, я получил сообщение
Перенаправлено на http://localhost:3090/ Завершено 500 Внутренняя ошибка сервера в 755 мс (ActiveRecord: 491,9 мс)
AbstractController::DoubleRenderError (Render and/or redirect were
called multiple times in this action. Please note that you may only
call render OR redirect, and at most once per action. Also note that
neither redirect nor render terminate execution of the action, so if
you want to exit an action after redirecting, you need to do
something like "redirect_to(...) and return".):