From d20d6c732613dcc7276cb57d451e2a3bf573df19 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Fri, 13 Jul 2018 12:17:33 -0400 Subject: Fix that detaching could purge --- activestorage/lib/active_storage/attached/many.rb | 2 +- activestorage/lib/active_storage/attached/one.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'activestorage/lib/active_storage/attached') diff --git a/activestorage/lib/active_storage/attached/many.rb b/activestorage/lib/active_storage/attached/many.rb index 204d6604c8..073cc013d8 100644 --- a/activestorage/lib/active_storage/attached/many.rb +++ b/activestorage/lib/active_storage/attached/many.rb @@ -41,7 +41,7 @@ module ActiveStorage # Deletes associated attachments without purging them, leaving their respective blobs in place. def detach - attachments.destroy_all if attached? + attachments.delete_all if attached? end ## diff --git a/activestorage/lib/active_storage/attached/one.rb b/activestorage/lib/active_storage/attached/one.rb index 960ff99e63..4a6bb1ffaa 100644 --- a/activestorage/lib/active_storage/attached/one.rb +++ b/activestorage/lib/active_storage/attached/one.rb @@ -45,7 +45,7 @@ module ActiveStorage # Deletes the attachment without purging it, leaving its blob in place. def detach if attached? - attachment.destroy + attachment.delete write_attachment nil end end -- cgit v1.2.3