thoughtbot/paperclip — pull request #1170 by mdotterer (2013-02-20 15:11:32+00:00)
Title: Clearing an attachment when preserve_files is enabled has no effect

If you have an attachment where the preserve_files option is enabled and you attempt to clear the attachment, nothing happens. After the save and reload the attachment will still exist and respond as if you never tried to clear it.

This pull request simply clears out the attachment fields on the instance, just like a call to clear when preserve_files is not enabled, only skipping adding the files to queued_for_delete. This way, the attachment behaves exactly as you expect. After clearing the attachment and saving the instance, the attachment will no longer be connected to the instance but the file will not be deleted.