aboutsummaryrefslogtreecommitdiffstats
path: root/lib/active_vault/attached/many.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/active_vault/attached/many.rb')
-rw-r--r--lib/active_vault/attached/many.rb13
1 files changed, 11 insertions, 2 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