I’m trying to work in Comments into my Rails 3.2 application. They are currently a nested resource to Topics, and I am having trouble managing validation errors for the New Comment form within Topic#show.
The way my code works is exactly the same as this: Simple Parent-child forms
My question is what is the preferred way to manage validation errors with a Parent-child form in the above post?
Thanks!
Since the
child#updatemethod redirects instead of renders an action, the errors object is lost when the new controller is loaded.The approach I’ve found most used is to display the error message in
flash[:error]. A responder can be added for Javascript where available.