In routes i have the root-path pointing \"home#index\" but when i try to override that with after_sign_up_path_for keeps redirecting me to the root path when I
Actually, we can view the source code of devise to solve the problem and it's easy.
devise-3.4.1 $ vim app/controllers/devise/registrations_controller.rb
# POST /resource
def create
build_resource(sign_up_params)
resource_saved = resource.save
yield resource if block_given?
if resource_saved
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_flashing_format?
sign_up(resource_name, resource)
respond_with resource, location: after_sign_up_path_for(resource)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_flashing_format?
expire_data_after_sign_in!
respond_with resource, location: after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
@validatable = devise_mapping.validatable?
if @validatable
@minimum_password_length = resource_class.password_length.min
end
respond_with resource
end
end
As code show:
if resource.active_for_authentication?
...
respond_with resource, location: after_sign_up_path_for(resource)
else
...
respond_with resource, location: after_inactive_sign_up_path_for(resource)