Topic: Validate without saving?
Is there a way to check for data validation without saving it to the database?
My situation is that I have a controller that saves data from a form to multiple tables (e.g., first text field to first table, second text field to second table).
If the save to the first table fails validation (e.g., blank input), I return a flash notice with the error.
But I'd like the flash notice to also include any errors that may be associated with the data for the second table (e.g., if second text field is also blank).
Right now my solution is to do a save and then a destroy for the data from the second text field so that any errors will be generated. But that seems like an unnecessary db action.
I found a run_validations! method on the Rails api, but it's not well documented and I just get a protected method error.