Closed dlibanori closed 3 years ago
@markevans could you guys give this PR some attention? we're using a monkey patch as a workaround to this problem and would like to remove it asap
cheers - will put in next release (also thanks for making conservative - it needs to work with ActiveModel-only models)
As wrongly stated at #477 changing
destroy_dragonfly_attachments
callback frombefore_destroy
toafter_destroy
is not related with transaction/commit. It was failing cause foreign key's constraint. It still doesn't work as expected on rollback and it deletes dragonfly attachment from store:The right callback is
after_destroy_commit
or a more general Rails callbackafter_commit on: :destroy
.This PR is very conservative. It tries to attach
after_commit
and fallback toafter_destroy
, so it should still work even if ORMs doesn't haveafter_commit
.