class ActiveStorage::Attachment
Attachments associate records with blobs. Usually that's a one record-many blobs relationship, but it is possible to associate many different records with the same blob. A foreign-key constraint on the attachments table prevents blobs from being purged if they’re still attached to any records.
Public Instance Methods
# File activestorage/app/models/active_storage/attachment.rb, line 20 def purge delete blob&.purge end
Synchronously deletes the attachment and purges the blob.
# File activestorage/app/models/active_storage/attachment.rb, line 26 def purge_later delete blob&.purge_later end
Deletes the attachment and enqueues a background job to purge the blob.
© 2004–2019 David Heinemeier Hansson
Licensed under the MIT License.