Using before_action :authenticate_user!
to check if user logged in. But it sends users to login
instead of signup
.
Tried different
What you are looking for is a referer.
Having your before_filter working, you can override the Devise's after_sign_up_path_for
:
def after_sign_up_path_for(user)
request.referer
end
Since request.referer
is somehow not working, I think you could go with a session-based solution:
def auth_user
session[:before_sign_up_path] = request.fullpath
redirect_to new_user_registration_url unless user_signed_in?
end
def after_sign_up_path_for(user)
session[:before_sign_up_path]
end