Saves files and attachments regardless of errors in the model
Uploaded files are a tricky thing. You really don't want to move the files into their final resting spot until the other stuff is saved. Ideally, you want:


Commit to database
Move files to permanent storage
(Optionally) One more commit to the database to update file paths or names


Validation errors, of course, throw this all out of whack. From a UI perspective you solve this by switching your form from "create mode" to "edit mode" -- don't show the "upload" field. Show the files in the UI as if you were editing something that already existed in file storage, except you are referencing a temp file on the server instead of a file in permanent storage.

So now the process becomes:


Run validations (they fail...)
Update a temporary copy of you model with the temp file paths


This is where a "view model" can be useful, so the object used to render things on screen does not have to adhere to the same constraints as your Active Record classes

Re-render the page so the user can correct the errors
User corrects errors
User submits form, including references to temp files
Commit to database
Move files to permanent storage
(Optionally) One more commit to the database to update file paths or names