aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage/attached
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-07-13 12:17:33 -0400
committerGeorge Claghorn <george@basecamp.com>2018-07-13 12:17:33 -0400
commitd20d6c732613dcc7276cb57d451e2a3bf573df19 (patch)
treed1af70d71ad09b3f688eb60dd094c5872af4eecd /activestorage/lib/active_storage/attached
parent63951072afc371e1393f3e185bee72e1bdcfdcfe (diff)
downloadrails-d20d6c732613dcc7276cb57d451e2a3bf573df19.tar.gz
rails-d20d6c732613dcc7276cb57d451e2a3bf573df19.tar.bz2
rails-d20d6c732613dcc7276cb57d451e2a3bf573df19.zip
Fix that detaching could purge
Diffstat (limited to 'activestorage/lib/active_storage/attached')
-rw-r--r--activestorage/lib/active_storage/attached/many.rb2
-rw-r--r--activestorage/lib/active_storage/attached/one.rb2
2 files changed, 2 insertions, 2 deletions
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