I have a model where the data is entered over 2 pages. I would like to validate the fields entered on the first page however it isn’t until the second page that the whole model can possibly be valid.
I want to use the standard Rails validation presentation (highlight the fields in error, display the message at the top, reload the page with all the data already in the fields). I would like to avoid coding the validation in the controller.
Has anyone seen a better approach than using the controller, or creating a new “dummy” model with just the data from the first page (which is never saved in the DB).
Thanks!
There is an excellent Railscast on this topic. Hopefully you will find useful.
http://railscasts.com/episodes/217-multistep-forms