aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/models
diff options
context:
space:
mode:
authorJasper Martin <jaspervanbrianmartin@gmail.com>2018-07-26 21:24:31 +0800
committerGeorge Claghorn <george.claghorn@gmail.com>2018-07-26 09:24:31 -0400
commit934fccd5223ae41f3f1cc7d548af509302f64828 (patch)
treeb4ed89df2087796fa7cbeb139803efda693ae154 /activestorage/app/models
parent8a5fe2bcded1468934f060666a69dcd7d1fac9ae (diff)
downloadrails-934fccd5223ae41f3f1cc7d548af509302f64828.tar.gz
rails-934fccd5223ae41f3f1cc7d548af509302f64828.tar.bz2
rails-934fccd5223ae41f3f1cc7d548af509302f64828.zip
Ignore ActiveRecord::InvalidForeignKey in ActiveStorage::Blob#purge
Do nothing instead of raising an error when it’s called on an attached blob.
Diffstat (limited to 'activestorage/app/models')
-rw-r--r--activestorage/app/models/active_storage/blob.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb
index bf87598a66..e7f2615b0f 100644
--- a/activestorage/app/models/active_storage/blob.rb
+++ b/activestorage/app/models/active_storage/blob.rb
@@ -207,6 +207,7 @@ class ActiveStorage::Blob < ActiveRecord::Base
def purge
destroy
delete
+ rescue ActiveRecord::InvalidForeignKey
end
# Enqueues an ActiveStorage::PurgeJob to call #purge. This is the recommended way to purge blobs from a transaction,