Reputation: 27
I have a rails model, which has a dragonfly attachment, stored on S3. Do you know how to configure dragonfly, so if you delete the rails object, the attachment itself would not be deleted automatically, but left in the storage?
Upvotes: 0
Views: 342
Reputation: 27
Okay, I found out. This User model will handle photos, but if a user is destroyed, it won't delete the actual photo attachments from the storage.
class User < ActiveRecord::Base # model
dragonfly_accessor :photo
skip_callback :destroy, :before, :destroy_dragonfly_attachments
end
Upvotes: 1
Reputation: 999
S3 don't destroy any object itself while deleting a record in your application. If you want to destroy that object from S3 as well, you have to write a callback that delete the object from S3, identified by the key(identifier of the object in S3).
Upvotes: 0