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:
http://railscasts.com/episodes/73-complex-forms-part-1
and probably part 2 or 3 as well,

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

Hope this helps,

Christophe


Le 12 mars 2010 à 11:11, Xianggong a écrit :

> 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
>         acts_as_polymorphic_paperclip
>        #  accepts_nested_attributes_for :assets, :allow_destroy => true
>      end
> 
>      And the controller  and view :
> 
>      class ScenesController < ApplicationController
>           
>          def create
>              @scene = Scene.new(params[:scene])
>              respond_to do |format|
>                 if @scene.save
>                    # bla bla ..
>                 else
>                    #  bla bla
>                 end
>              end
>          end 
> 
>      end
> 
>      #view:
>         <% 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
> 
>         Regards
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to