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.
Attachments also have access to all methods from
Instance Public methods
Synchronously deletes the attachment and purges the blob.
# File activestorage/app/models/active_storage/attachment.rb, line 23 def purge transaction do delete record&.touch end blob&.purge end