aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/models/active_storage/blob.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2017-12-02 22:43:28 -0500
committerGitHub <noreply@github.com>2017-12-02 22:43:28 -0500
commit8c5a7fbefd3cad403e7594d0b6a5488d80d4c98e (patch)
tree837dc872b3769a9ec4e08096c0ef2847288f64ba /activestorage/app/models/active_storage/blob.rb
parentb23e381c89aa91451d73d3a1b1b6e4cbe7bc7780 (diff)
downloadrails-8c5a7fbefd3cad403e7594d0b6a5488d80d4c98e.tar.gz
rails-8c5a7fbefd3cad403e7594d0b6a5488d80d4c98e.tar.bz2
rails-8c5a7fbefd3cad403e7594d0b6a5488d80d4c98e.zip
Purge variants with their blobs
Diffstat (limited to 'activestorage/app/models/active_storage/blob.rb')
-rw-r--r--activestorage/app/models/active_storage/blob.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/activestorage/app/models/active_storage/blob.rb b/activestorage/app/models/active_storage/blob.rb
index 2aa05d665e..acaf22fac1 100644
--- a/activestorage/app/models/active_storage/blob.rb
+++ b/activestorage/app/models/active_storage/blob.rb
@@ -270,7 +270,8 @@ class ActiveStorage::Blob < ActiveRecord::Base
# deleted as well or you will essentially have a dead reference. It's recommended to use the +#purge+ and +#purge_later+
# methods in most circumstances.
def delete
- service.delete key
+ service.delete(key)
+ service.delete_prefixed("variants/#{key}/") if image?
end
# Deletes the file on the service and then destroys the blob record. This is the recommended way to dispose of unwanted