From 934fccd5223ae41f3f1cc7d548af509302f64828 Mon Sep 17 00:00:00 2001 From: Jasper Martin Date: Thu, 26 Jul 2018 21:24:31 +0800 Subject: Ignore ActiveRecord::InvalidForeignKey in ActiveStorage::Blob#purge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do nothing instead of raising an error when it’s called on an attached blob. --- activestorage/app/models/active_storage/blob.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activestorage/app/models') 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, -- cgit v1.2.3