diff options
Diffstat (limited to 'activestorage/lib')
-rw-r--r-- | activestorage/lib/active_storage/attached/changes/create_many.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/activestorage/lib/active_storage/attached/changes/create_many.rb b/activestorage/lib/active_storage/attached/changes/create_many.rb index af19328a61..a7a8553e0f 100644 --- a/activestorage/lib/active_storage/attached/changes/create_many.rb +++ b/activestorage/lib/active_storage/attached/changes/create_many.rb @@ -21,7 +21,8 @@ module ActiveStorage end def save - record.public_send("#{name}_attachments=", attachments) + assign_associated_attachments + reset_associated_blobs end private @@ -32,5 +33,14 @@ module ActiveStorage def build_subchange_from(attachable) ActiveStorage::Attached::Changes::CreateOneOfMany.new(name, record, attachable) end + + + def assign_associated_attachments + record.public_send("#{name}_attachments=", attachments) + end + + def reset_associated_blobs + record.public_send("#{name}_blobs").reset + end end end |