Jak zuploadować wiele załączników do formularza?

Używam jquery-fileupload-rails do uploadowania plików.

Jak najprościej zrefaktorować to tak abym mógł do formularza w którym tworzę dokument, mógł dodawać wiele załączników.

W tym momencie przy wybraniu kilku plików tworzy mi się odpowiednia ilość dokumentów z pojedynczymi załącznikami.

Formularz

= simple_form_for [:member, @document], html: { multipart: true } do |f|
  = f.input :name
  = f.simple_fields_for :attachments, Attachment.new do |a|
    = a.file_field :attachment, multiple: true, name: "document[attachments_attributes][][attachment]"
  = f.submit

Generates:

<input id="document_attachments_attributes_0_attachment" multiple="multiple" name="document[attachments_attributes][][attachment]" type="file">

JS

jQuery ->
	$('#new_document').fileupload()

Modele

class Document < ActiveRecord::Base
  has_many :attachments
  accepts_nested_attributes_for :attachments
end

class Attachment < ActiveRecord::Base
  belongs_to :document

  has_attached_file :attachment
end

Kontroler

class Member::DocumentsController < ApplicationController
  def new
    @document = Document.new
  end

  def create
    @document = Document.new params[:document]

    if @document.save
      redirect_to member_documents_path, notice: "Created"
    else
      redirect_to member_documents_path, alert: "Not created"
    end
  end

  private

  def document_params
    params.require(:document).permit(:name, attachments_attributes: [:attachment])
  end
end