Rails 5 CarrierWave, can't remove last file in a multiple upload
<p>Following this How-to:</p>

<p><a href="https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Add-more-files-and-remove-single-file-when-using-default-multiple-file-uploads-feature" rel="nofollow">https://github.com/carrierwaveuploader/carrierwave/wiki/How-to:-Add-more-files-and-remove-single-file-when-using-default-multiple-file-uploads-feature</a></p>

<pre class="lang-ruby prettyprint-override"><code>class ImagesController &lt; ApplicationController
  before_action :set_gallery

  def create
    add_more_images(images_params[:images])
    flash[:error] = "Failed uploading images" unless @gallery.save
    redirect_to :back
  end

  def destroy
    remove_image_at_index(params[:id].to_i)
    flash[:error] = "Failed deleting image" unless @gallery.save
    redirect_to :back
  end

  private

  def set_gallery
    @gallery = Gallery.find(params[:gallery_id])
  end

  def add_more_images(new_images)
    images = @gallery.images 
    images += new_images
    @gallery.images = images
  end

  def remove_image_at_index(index)
    remain_images = @gallery.images # copy the array
    deleted_image = remain_images.delete_at(index) # delete the target image
    deleted_image.try(:remove!) # delete image from S3
    @gallery.images = remain_images # re-assign back
  end

  def images_params
    params.require(:gallery).permit({images: []}) # allow nested params as array
  end
end
</code></pre>

<p>I seem to not be able to correctly remove the very last file. In my printed file list it keeps on standing there. Oddly enough with 0kb.</p>

<p>Then when I load up new files this one does go away.</p>