Deepak Kevat
Deepak Kevat

Reputation: 47

Redirect rails devise after sign up to specific route

I am trying to add redirect, so after registration, user should redirect to user edit. But it is redirecting to root link. The code is

    def after_sign_up_path_for(resource)
       redirect_to edit_user_path(resource)
    end

This was working fine but now it is redirecting to root route. How can I remove this issue.

Upvotes: 0

Views: 39

Answers (2)

Luis Menjivar
Luis Menjivar

Reputation: 777

You have to create a RegistrationsController to over ride Devise's after_sign_up method. These are good instructions. Take into consideration that if the account has to be confirmed by email first, you have to define the after_inactive_sign_up_path_for method. Devise's defaults are the application's root.

Upvotes: 0

Shriram Balakrishnan
Shriram Balakrishnan

Reputation: 509

The actual path is returned in after_sign_up_path_for method. So redirect_to in it is not needed.

If 'edit_user_path(resource)' exists, then the following should work

def after_sign_up_path_for(resource)
  edit_user_path(resource)
end

Upvotes: 0

Related Questions