Redirect to the registration page if the user is not logged in

Considering the development code and the wiki, it seems there is no way to redirect the user to the registration page if the user is not logged in. In lib / devise / fail_app.rb, it seems that the redirect URL is hard-coded.

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 

I want to ask what is the best practice in doing the job. I am thinking of manually setting the user_return_to session value, and then making a call to the registration page. Is this a good practice?

+6
source share
1 answer

Source: https://habr.com/ru/post/900758/


All Articles