方法:对于不同的用户注册或登录之后的跳转不同的页面
application_controller.rb
def after_sign_in_path_for(resource)
if current_user.status&¤t_user.status == "admin"
company_works_path
elsif current_user.status&¤t_user.status == "user"
root_path
else
root_path
end
end
参考资料:1