Using before_action :authenticate_user!
to check if user logged in. But it sends users to login
instead of signup
.
Tried different
I haven't tried it but this seems to be what you are looking for. Note that it says that it is out of date. So you should see the source code if you want to understand what's going on.
Navigating through the source code of Devise(this and this) my guess is that you can extend Devise::RegistrationsController
and then override the method after_sign_up_path_for
to be stored_location_for(:user) || root_path
.