diff --git a/lib/carrierwave/mounter.rb b/lib/carrierwave/mounter.rb index 6b18fdccf..2ebe89dea 100644 --- a/lib/carrierwave/mounter.rb +++ b/lib/carrierwave/mounter.rb @@ -41,7 +41,7 @@ def uploaders end def cache(new_files) - return if new_files.blank? + return if !new_files.is_a?(Array) && new_files.blank? old_uploaders = uploaders @uploaders = new_files.map do |new_file| handle_error do diff --git a/spec/mount_multiple_spec.rb b/spec/mount_multiple_spec.rb index eea5435fd..20725b315 100644 --- a/spec/mount_multiple_spec.rb +++ b/spec/mount_multiple_spec.rb @@ -309,6 +309,16 @@ def monkey expect { instance.store_images! }.not_to raise_error expect(instance.images.map(&:identifier)).to be_empty end + + it "allows deleting all files" do + instance.images = [] + expect(instance.images.map(&:identifier)).to be_empty + end + + it "allows assignment of uploader instances" do + instance.images = [instance.images[0]] + expect(instance.images.map(&:identifier)).to eq ['bork.txt'] + end end end