I am implementing a multi-page form and I want the user to be redirected to the same page if there is a validation error on a form, rather than the model's edit/new page. To get around this, I updated the controller action for the model so it redirects if the instance can not be saved. However, in doing so the error messages are lost - is there a way to redirect and inc开发者_如何学Clude the generated error messages?
Generally while dealing with error on forms, people use to render on save errors and redirect on save success. If you render, your errors and flash will be kept.
You just have to make sure that all instance variable needed in each of your pages are set in the controller doing the render.
精彩评论