From 7d3955e6f7c9a38a226dff81bb9b436bae91590d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 5 Jul 2017 18:29:43 +0200 Subject: Avoid duplicate attachments --- lib/active_vault/attached/many.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/active_vault') diff --git a/lib/active_vault/attached/many.rb b/lib/active_vault/attached/many.rb index 49c6aae575..83fab12385 100644 --- a/lib/active_vault/attached/many.rb +++ b/lib/active_vault/attached/many.rb @@ -6,7 +6,7 @@ class ActiveVault::Attached::Many < ActiveVault::Attached end def attach(*attachables) - @attachments = attachments + Array(attachables).flatten.collect do |attachable| + @attachments = attachments | Array(attachables).flatten.collect do |attachable| ActiveVault::Attachment.create!(record_gid: record.to_gid.to_s, name: name, blob: create_blob_from(attachable)) end end -- cgit v1.2.3