0

I have followed the directions here:

https://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-up-(registration)

I am succesfully using my own registrations controller. Here is my routes code:

devise_for :users, controllers: {registrations: "users/registrations", sessions: "users/sessions", passwords: "users/passwords", confirmations: "users/confirmations"}

Here is my controller code:

class Users::RegistrationsController < Devise::RegistrationsController
    def new
        super
    end

    def create
         puts "in my custom create action"
         super
    end

    protected

    def after_sign_up_path_for(resource)
        puts "in after sign up path for"
        if resource.new_record? #user not created. Do default behavior: render new user page
            puts "new record"
        else #user created
            puts "user created"
            return new_user_session_path
        end
    end
end

I know the create action is being called because the puts "in my custom create action" appears in the server logs. For some reason, after_sign_up_path_for(resource) is not being called. I am using Devise confirmable - will that make a difference. How do I fix this?

Philip7899
  • 4,599
  • 4
  • 55
  • 114

1 Answers1

0

Yes, confirmable does make a difference, as the user is not yet active in the system. You can do this instead in your custom controller:

def after_inactive_sign_up_path_for resource
  # Custom code here
end
GoGoCarl
  • 2,519
  • 13
  • 16