How to get paperclip to delete files

Posted by webdestroya on Stack Overflow See other posts from Stack Overflow or by webdestroya
Published on 2010-05-25T03:26:25Z Indexed on 2010/05/25 3:31 UTC
Read the original article Hit count: 312

Filed under:
|
|

I have a model that is using Paperclip to manage the file.

After I delete the model, I obviously would like the file to be deleted as well, but I cannot seem to find out how to get the file deleted using Paperclip.

I have tried self.sourcefile = nil if !sourcefile.dirty? in the before_destroy def, but that had no effect.

(I want to be able to have it delete the file locally when I test, and then on S3 when I use that - So i need a pure paperclip solution)

Any ideas?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby