From e8682c5bf051517b0b265e446aa1a7eccfd47bf7 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Sat, 7 Jul 2018 23:25:33 -0400 Subject: Store newly-uploaded files on save rather than assignment --- activestorage/lib/active_storage/attached.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activestorage/lib/active_storage/attached.rb') diff --git a/activestorage/lib/active_storage/attached.rb b/activestorage/lib/active_storage/attached.rb index c08fd56652..1b53818581 100644 --- a/activestorage/lib/active_storage/attached.rb +++ b/activestorage/lib/active_storage/attached.rb @@ -15,6 +15,10 @@ module ActiveStorage end private + def change + record.attachment_changes[name] + end + def create_blob_from(attachable) case attachable when ActiveStorage::Blob @@ -35,6 +39,7 @@ module ActiveStorage end end +require "active_storage/attached/model" require "active_storage/attached/one" require "active_storage/attached/many" -require "active_storage/attached/macros" +require "active_storage/attached/changes" -- cgit v1.2.3