@WIP Fixed bug where processing occurs on invalid objects #1
+107
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because the processors were called on assignment, instead of during saving,
the validations could never work correctly. This is because the built in
validations use the values in the db columns to operate. However, since these
are populated on assignment, the validations cannot run before the processors
run. Moreover, any other type of validation not dependent on the db columns
also cannot run, because the processors are called on assignment. The
processors should be called during save which allows for validations to occur.
Fixed tests that assert the incorrect behavior
Closes Post processing callbacks are run on invalid attachments. thoughtbot/paperclip#2462, Closes Conflict between README and Wiki on Post Processing. thoughtbot/paperclip#2321, Closes
contradictory wiki / readme about preprocessing invalid too-large files thoughtbot/paperclip#2236, Closes after_post_process is run even if validations fail thoughtbot/paperclip#2178,
Closes Failing validations don't prevent post_processing callbacks thoughtbot/paperclip#1960, Closes DRAFT toward fixing after_post_process is run even if validations fail thoughtbot/paperclip#2204