newbie seek for help about paperclippolymorph

Hi All,
I am new to rails and I need to upload multiple images with paperclippolymorph , I have a model “scene” like this:

 class Scene < ActiveRecord::Base
    belongs_to :user
   #  accepts_nested_attributes_for :assets, :allow_destroy => true

 And the controller  and view :

 class ScenesController < ApplicationController
     def create
         @scene =[:scene])
         respond_to do |format|

               # bla bla ..
               #  bla bla


    <% form_for(@scene, :html => { :multipart => true }) do |f| %>

          <%= f.file_field :data %>  <!-- it's just a single file field, how to enable multiple upload? -->
          <%= f.submit "submit" %>
    <% end %>

  I can upload single image successfully but don't know how to upload multiple, my question is how can I upload multiple image at once? I have tried with fields_for like following and it failed,  does anyone have idea?

<% form_for(@scene, :html => { :multipart => true }) do |f| %>
<% f.fields_for :assets do |asset_field| %>
<%= asset_field.file_field :data %>
<%= asset_field.file_field :data %>
<% end %>
<% end %>

    Any advice is appreciated, thanks


Hi there,

I’m not a longtime Rails developper so pardon me if misunderstood your pb.

But IMHO, I believe you’re looking for a solution to enable multiple records creation through one form.

Why don’t you have a look at this short video:

and probably part 2 or 3 as well,

Anyway, it helped me to sort out a rather similar problem

Hope this helps,


thank you Christophe, it’s really helpful, and it works for me.