Failed to create Devise edit path - Rails

I searched high and low for documents on how to change the registration path after a failed registration.

I have my registration form on the page of my site. If registration fails, it redirects to new_user_registration_path not root, where the user was. How do I update this?

+4
source share
2 answers

I was able to achieve this for the registration form using the customfailure application

class CustomFailure < Devise::FailureApp def redirect_url if warden_options[:scope] == :user new_user_registration_path else new_user_registration_path end end def respond if http_auth? http_auth else redirect end end def redirect store_location! flash[:alert] = i18n_message unless flash[:notice] redirect_to '/' end end 

Perhaps a similar option is possible that does not require overriding the development registration controller?

+1
source

You can copy the development registration controller from here

You should add something like this:

 if resource.save #handle this else #handle this redirect_to new_user_registration_path end 

Then in your routes:

  devise_for :users, :controllers => {:registrations => 'registrations'} 

I'm not sure how to do this without overriding the controller

0
source

All Articles