If you’re using the Devise gem to handle authentication duties for your application, you going to need a way to
determine what happens after the user signs in, signs up, or signs out of your application. Devise provides a means to
do this with the
after_sign_out_path_for methods. Simply override
these methods with your own methods of the same name in your
ApplicationController, and you’re all set.
Except there’s a catch. Overriding
work, but if you override
after_sign_up_path_for, it won’t work. It turns out that you need to override the
RegistrationsController class, and override the method inside that controller. Your new controller will look something
class RegistrationsController < Devise::RegistrationsController
if resource.is_a?(User) && resource.account&.needs_subscription?