I have a simple Devise registration form with the validatable
plugin. It mostly works as intended, if the user forgets to enter a first name it redirects them back with a red validation message.
The problem is it redirects to the same path a successful login would have the user go to (i.e. it redirects them to /user
and not back to /user/sign_up
). If the user then refreshes the page for whatever reason they get a No route matches [GET] "/user"
error.
How can I force a redirect to go back to the original /user/sign_up
route on a sign up failure? I know I can hack the create
action in the registration controller but when I redirect to the proper route I lose the Devise validation messages.
Update
It appears the problem is the way Devise handles respond_with
Rails 4 How Overwrite Devise Respond Path Upon Error. It looks like Devise tries to render a create
template at /user but I still can't override it.