In my Rails 6 app, I have implemented Devise, and the confirmable module. The default behavior for confirmable is that after a user is created, the user is redirected to the root path.
I want to redirect only these people who just created accounts to the new_user_session_path
instead of the root path.
I've read through SO questions and the Devise Wiki, but it only addresses where someone is redirected to after a user has confirmed their account.
What I've tried:
Changing the Root:
devise_scope :user do
root to: "devise/sessions#new"
end
This did redirect users to the sign in page after they created the account, but it also redirected all users to this page when they went to my root URL, i.e. foo.com.
Changing Registrations Controller
I added to this to my controller:
def after_sign_up_path_for(resource)
new_user_session_path
end
This had no effect. Does anyone know how this can be done (either redirecting to another page other than root, or possibly changing my routes to redirect them if they came from registrations#new)?
Okay you have to override
after_inactive_sign_up_path_for
Because you are using the confirmable module This may help you.