class ActiveStorage::Attachment
on the attachments table prevents blobs from being purged if they’re still attached to any records.
but it is possible to associate many different records with the same blob. A foreign-key constraint
Attachments associate records with blobs. Usually that’s a one record-many blobs relationship,
def analyze_blob_later
def analyze_blob_later blob.analyze_later unless blob.analyzed? end
def dependent
def dependent record.attachment_reflections[name]&.options[:dependent] end
def identify_blob
def identify_blob blob.identify end
def purge
def purge delete blob&.purge end
def purge_dependent_blob_later
def purge_dependent_blob_later blob&.purge_later if dependent == :purge_later end
def purge_later
def purge_later delete blob&.purge_later end