I want to use paperclip gem with permanent_records gem (https://github.com/JackDanger/permanent_records) but I have some problems. When I destroy attachment, not only deleted_at column is set to DateTime.now, but the file itself is deleted too - data_file_type, data_file_size and data_file_name is set to NULL.
Can I do something to avoid this?
What you could do is override prepare_for_destroy in your model to return true, or add some checking to see that it should destroy the attachment or not.
(Don't return false, as it will halt the chain)
You can see that Paperclip add the callback in https://github.com/thoughtbot/paperclip/blob/v3.0.1/lib/paperclip.rb#L182 which executes https://github.com/thoughtbot/paperclip/blob/v3.0.1/lib/paperclip/instance_methods.rb#L28-33.
Thanks for answer, it helped!
def destroy(force = nil)
if :force == force
each_attachment do |name, attachment|
I did it in this way, because I do need files to be reoved when destroy is called with :force parametr. But I get an error
undefined method `queue_existing_for_delete' for #<Paperclip::Attachment:0xfc8cb34>
Can you help me please?