Topic: setting up file_field to upload multiple files

Hello everyone,
I'm following this railscast:

I want to do something similar in a form with nested attributes for uploading images. The main table is users. each has_many images. The application works fine for uploading a single file (using carrierwave).

The problem is, in the initial stages of the railscasts, changing the file_field is causing a problem.


<%= f.fields_for :images do |z| %>
    <%= z.label :image_title %><br />
    <%= z.text_field :image_title %>
    <%= z.hidden_field :image_priority, :value => '1' %> 
    <%= z.file_field :image_location %>
<% end %>

The railscast says you should add a "multiple" option to file_Field and then "hardcode" the field name. So somthing like this:

<%= z.file_field :image_location, multiple: true, name: "images[image_location]" %>

But this doesn't work. Once I change this, the image_location field in the images table is not populated. I suppose the problem is related to it being a nested form. How can I fix this? My end goal is to have a form with multiple uploads and progress bars using jquery-fileupload.

Have a nice week,