app/controllers/spina/admin/attachments_controller.rb in spina-2.9.0 vs app/controllers/spina/admin/attachments_controller.rb in spina-2.9.1

- old
+ new

@@ -15,13 +15,15 @@ @attachment = Attachment.find(params[:id]) end def create @attachments = params[:attachment][:files].map do |file| + next if file.blank? # Skip the blank string posted by the hidden files[] field + attachment = Attachment.create(attachment_params) attachment.file.attach(file) attachment - end + end.compact respond_to do |format| format.turbo_stream { render turbo_stream: turbo_stream.prepend("attachments", partial: "attachment", collection: @attachments)} format.html { redirect_to spina.admin_attachments_url } end