aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/models/active_storage/attachment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activestorage/app/models/active_storage/attachment.rb')
-rw-r--r--activestorage/app/models/active_storage/attachment.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activestorage/app/models/active_storage/attachment.rb b/activestorage/app/models/active_storage/attachment.rb
index 1c4dc25094..4bdd1c0224 100644
--- a/activestorage/app/models/active_storage/attachment.rb
+++ b/activestorage/app/models/active_storage/attachment.rb
@@ -20,13 +20,13 @@ class ActiveStorage::Attachment < ActiveRecord::Base
# Synchronously deletes the attachment and {purges the blob}[rdoc-ref:ActiveStorage::Blob#purge].
def purge
delete
- blob.purge
+ blob&.purge
end
# Deletes the attachment and {enqueues a background job}[rdoc-ref:ActiveStorage::Blob#purge_later] to purge the blob.
def purge_later
delete
- blob.purge_later
+ blob&.purge_later
end
private
@@ -39,7 +39,7 @@ class ActiveStorage::Attachment < ActiveRecord::Base
end
def purge_dependent_blob_later
- blob.purge_later if dependent == :purge_later
+ blob&.purge_later if dependent == :purge_later
end