[英]Redirect after devise sign up
在我的注冊表單中,我有一個虛擬的布爾參數:register_as_company(復選框)。
我希望將選中此框的用戶重定向到“ companies / new”,並將其他所有人重定向。
此頁面有一個解決方案https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-up-(注冊),但我沒有知道如何將參數傳遞給該方法,以便我可以檢查用戶是否選中了該框。
有沒有辦法做到這一點? 我應該從哪里開始?
在您的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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.