Cla*_*ark 6 ruby-on-rails devise
从阅读设计代码和维基似乎,如果用户没有登录,则没有选项将用户重定向到注册页面.在lib/devise/failure_app.rb中,似乎重定向URL是硬编码的.
def redirect_url
opts = {}
route = :"new_#{scope}_session_path"
opts[:format] = request_format unless skip_format?
if respond_to?(route)
send(route, opts)
else
root_path(opts)
end
end
Run Code Online (Sandbox Code Playgroud)
我想问这是完成工作的最佳实践.我正在考虑手动设置user_return_to会话值,然后调用注册页面.这是一个好习惯吗?
我认为这种情况下的最佳实践是遵循此 devise wiki 页面:https://github.com/plataformatec/devise/wiki/How-To%3A-Redirect-to-a-specific-page-when-the-user -无法验证
| 归档时间: |
|
| 查看次数: |
4913 次 |
| 最近记录: |