class ActiveStorage::Attachment

Schema: id, record_gid, blob_id, created_at

Public Instance Methods

purge() click to toggle source
# File lib/active_storage/attachment.rb, line 22
def purge
  blob.purge
  destroy
end
purge_later() click to toggle source
# File lib/active_storage/attachment.rb, line 27
def purge_later
  ActiveStorage::PurgeJob.perform_later(self)
end
record() click to toggle source
# File lib/active_storage/attachment.rb, line 13
def record
  @record ||= GlobalID::Locator.locate(record_gid)
end
record=(record) click to toggle source
# File lib/active_storage/attachment.rb, line 17
def record=(record)
  @record = record
  self.record_gid = record&.to_gid
end