0
votes

I want to redirect to the rooth path after a users confirms his email by clicking on the activation link. The devise wiki says to implement the following method in the registrations controller:

  def after_inactive_sign_up_path_for(resource_or_scope)
    session["user_return_to"] || root_path
  end

But it doesnt get picked up and keeps directing my to the following url:

http://localhost:3000/users/sign_in

How can i override this behaviour of devise?

2
Have you checked if the method is called? Put inside a breakpoint or a puts to ensure that is executed. Do you have set up the route for the registration controller? - NickGnd
have you tried this method after_confirmation_path_for ? - rails_id
Thanks you anonymousxxx that was the method i was looking for - cccvandermeer

2 Answers

0
votes
def after_inactive_sign_up_path_for(resource_or_scope)
   root_path
end
0
votes

Anonymousxxx posted the answer in a comment. The method is supposed to be in the confirmationscontroller.

module Users
  class ConfirmationsController < Devise::ConfirmationsController
    protected

    def after_confirmation_path_for(_, _)
      root_path
    end
  end
end