How to skip to the registration page if you need to log in to the rails device.

Asked 2 years ago, Updated 2 years ago, 119 views

Please tell me how to skip to the registration page if I need to log in to the rails device.

By default, it flies to the login page (new_user_session), but how do I direct it to the registration page (new_user_registration)?

ruby-on-rails devise

2022-09-30 19:21

2 Answers

You can override redirect_url in a class inherited from How To:Redirect to a specific page when the user can not be authenticated in the device document.

without using the default authenticate_user!
before_action:authenticate

def authenticate
  redirect_to new_user_registration_urlunless user_signed_in?
end

Would it be easier to redirect as ?


2022-09-30 19:21

Should I be able to register in new_user_session or make some decision in new_user_session and redirect it to new_user_registration?


2022-09-30 19:21

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.