【发布时间】:2019-09-02 21:54:26
【问题描述】:
我正在使用设计并尝试在注册表单后将我的用户重定向到特定模板。
我已经检查了有关 after_inactive_sign_up_path_for 方法的文档,但我收到一个异常说我重定向了两次。
RegistrationsController < Devise::RegistrationsController
def create
super
UsersCreateJob.perform_later(resource.id) if resource.persisted?
end
protected
def after_inactive_sign_up_path_for(resource)
render template: 'devise/registrations/success'
end
Exception
AbstractController::DoubleRenderError in RegistrationsController#create
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".
据我了解,after_inactive_sign_up_path_for 方法会覆盖来自设计注册控制器的方法并重定向到我的模板,对吗?这个其他模板来自哪里?
【问题讨论】:
标签: ruby-on-rails ruby devise