从阅读设备代码和维基百科来看,如果用户没有登录,则似乎没有将用户重定向到注册页面的选项。在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
我想问一下在完成工作时最佳实践是什么?我考虑手动设置"user_return_to"会话值,然后调用注册页面。这是一个好的做法吗?