Class: ActiveStorage::Attachment
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ActiveStorage::Attachment
- Defined in:
- lib/active_storage/attachment.rb
Overview
Schema: id, record_gid, blob_id, created_at
Instance Method Summary collapse
Instance Method Details
#purge ⇒ Object
22 23 24 25 |
# File 'lib/active_storage/attachment.rb', line 22 def purge blob.purge destroy end |
#purge_later ⇒ Object
27 28 29 |
# File 'lib/active_storage/attachment.rb', line 27 def purge_later ActiveStorage::PurgeJob.perform_later(self) end |
#record ⇒ Object
13 14 15 |
# File 'lib/active_storage/attachment.rb', line 13 def record @record ||= GlobalID::Locator.locate(record_gid) end |
#record=(record) ⇒ Object
17 18 19 20 |
# File 'lib/active_storage/attachment.rb', line 17 def record=(record) @record = record self.record_gid = record&.to_gid end |