设计注册后重定向

时间:2014-06-24 13:44:17

标签: ruby-on-rails devise

在我的注册表单中,我有一个虚拟的bool参数:register_as_company(复选框)。

我希望选中该框的用户被重定向到公司/新的'和其他人一起索引。

此页面有一个解决方案https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-up-(registration),但我不知道如何将参数传递给该方法,以便我可以检查用户是否选中了该框。

有办法做到这一点吗?我应该从哪里开始?

1 个答案:

答案 0 :(得分:1)

RegistrationsController

def after_sign_in_path_for(resource)
    if params[:user][:register_as_company]
        new_company_path
    else
        stored_location_for(resource) || root_path
    end
end
相关问题