如果符合某些条件,我正在尝试登录并将用户重定向到home_path
,否则他们会被取消批准并重定向到其他网页。当我通过控制器登录用户时,它们被重定向到users#show
但是(users /:id)。
如何签名,并让它从注册控制器重定向到home_path
'profile/home'
?
注册管理员:
def after_inactive_sign_up_path_for(resource)
if resource.location === "New York, NY, United States"
if (really long query)
puts "accepted!"
resource.approved = true
resource.save!
sign_in(resource)
home_path
else
puts "Not accepted"
'/profile/waitlist'
end
else
puts "City is not New York!"
'/profile/waitlist'
end
end
应用程序控制器
def after_sign_in_path_for(resource)
home_path
end
提前谢谢
答案 0 :(得分:0)
您需要确保使用sign_in_and_redirect_method
,否则不会调用网址助手。