Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Conflict between README and Wiki on Post Processing. #2321

Closed
RyanTimoney opened this issue Oct 13, 2016 · 3 comments · Fixed by kreeti/kt-paperclip#16 · May be fixed by #2594
Closed

Conflict between README and Wiki on Post Processing. #2321

RyanTimoney opened this issue Oct 13, 2016 · 3 comments · Fixed by kreeti/kt-paperclip#16 · May be fixed by #2594

Comments

@RyanTimoney
Copy link

The Events section in the README seems to conflict with the Prevent thumbnail generation for invalid uploads entry in the Wiki.

README:

NOTE: Post processing will not even start if the attachment is not valid according to the validations. Your callbacks and processors will only be called with valid attachments.

Wiki:

...paperclip still processes all styles during assignment before the model object is recognized as invalid during #save

Either I don't understand validations and #save well enough to not see a conflict here, or the Wiki just needs to be updated. This is my first run with Paperclip, so I need a sanity check before touching the wiki.

@tute
Copy link
Contributor

tute commented Oct 13, 2016

This is a buggy area of the code. Related with: #2204

saghaulor added a commit to saghaulor/paperclip that referenced this issue Apr 26, 2018
- 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 thoughtbot#2462, Closes thoughtbot#2321, Closes
  thoughtbot#2236, Closes thoughtbot#2178,
  Closes thoughtbot#1960, Closes thoughtbot#2204
@sidraval
Copy link
Contributor

Looks like there's an open PR that will solve this, closing.

saghaulor added a commit to saghaulor/paperclip that referenced this issue Aug 19, 2018
- 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 thoughtbot#2462, Closes thoughtbot#2321, Closes
  thoughtbot#2236, Closes thoughtbot#2178,
  Closes thoughtbot#1960, Closes thoughtbot#2204
@ssinghi
Copy link

ssinghi commented Dec 30, 2019

This has been fixed at https://github.com/kreeti/paperclip/commits/master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.