aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage/attached.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2018-07-07 23:25:33 -0400
committerGitHub <noreply@github.com>2018-07-07 23:25:33 -0400
commite8682c5bf051517b0b265e446aa1a7eccfd47bf7 (patch)
treecc04c8a28113bc0fa3748fdc6035d487e3e16af7 /activestorage/lib/active_storage/attached.rb
parent0b534cd1c814a4db2d0aa283981f1d55e5e62d25 (diff)
downloadrails-e8682c5bf051517b0b265e446aa1a7eccfd47bf7.tar.gz
rails-e8682c5bf051517b0b265e446aa1a7eccfd47bf7.tar.bz2
rails-e8682c5bf051517b0b265e446aa1a7eccfd47bf7.zip
Store newly-uploaded files on save rather than assignment
Diffstat (limited to 'activestorage/lib/active_storage/attached.rb')
-rw-r--r--activestorage/lib/active_storage/attached.rb7
1 files changed, 6 insertions, 1 deletions
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"