diff options
author | George Claghorn <george.claghorn@gmail.com> | 2017-12-02 22:43:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-02 22:43:28 -0500 |
commit | 8c5a7fbefd3cad403e7594d0b6a5488d80d4c98e (patch) | |
tree | 837dc872b3769a9ec4e08096c0ef2847288f64ba /activestorage/app/models | |
parent | b23e381c89aa91451d73d3a1b1b6e4cbe7bc7780 (diff) | |
download | rails-8c5a7fbefd3cad403e7594d0b6a5488d80d4c98e.tar.gz rails-8c5a7fbefd3cad403e7594d0b6a5488d80d4c98e.tar.bz2 rails-8c5a7fbefd3cad403e7594d0b6a5488d80d4c98e.zip |
Purge variants with their blobs
Diffstat (limited to 'activestorage/app/models')
-rw-r--r-- | activestorage/app/models/active_storage/blob.rb | 3 |
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 |