diff options
-rw-r--r-- | lib/active_vault/attached/many.rb | 13 | ||||
-rw-r--r-- | lib/active_vault/attached/one.rb | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/lib/active_vault/attached/many.rb b/lib/active_vault/attached/many.rb index 83fab12385..6f79a1c555 100644 --- a/lib/active_vault/attached/many.rb +++ b/lib/active_vault/attached/many.rb @@ -16,7 +16,16 @@ class ActiveVault::Attached::Many < ActiveVault::Attached end def purge - attachments.each(&:purge) - @attachments = nil + if attached? + attachments.each(&:purge) + @attachments = nil + end + end + + def purge_later + if attached? + attachments.each(&:purge_later) + @attachments = nil + end end end diff --git a/lib/active_vault/attached/one.rb b/lib/active_vault/attached/one.rb index 5566c1b971..9bf83254c0 100644 --- a/lib/active_vault/attached/one.rb +++ b/lib/active_vault/attached/one.rb @@ -18,7 +18,16 @@ class ActiveVault::Attached::One < ActiveVault::Attached end def purge - attachment.purge - @attachment = nil + if attached? + attachment.purge + @attachment = nil + end + end + + def purge_later + if attached? + attachment.purge_later + @attachment = nil + end end end |