I am trying to create a simple website with a landing page and a user registration form on the landing page itself.
I am having trouble figuring out how to change the devise registration controller to redirect back to the landing page (root path "/") when there is a form error during the registration (such as a missing field).
Right now, if there is a successful registration, the form works properly. However, if there is an error in the registration, it redirects to /users/sign_up view which only contains the registration form. I need it to redirect/render the landing page in the event that there is an error during the registration.
I have generated a custom registration controller, however right now it only calls super.
# POST /resource
def create
super
end
I have also looked at after_sign_up_path_for, however that does not work since that path is only called upon a successful registration.
I suspect that the solution might be a simple one given that this sort of design pattern can be quite common, however I cant figure out how to do it.