Hi All,
I am new to rails and I need to upload multiple images with
paperclippolymorph <http://github.com/heavysixer/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.