I'm using Rails 3.2, Carrierwave and simple_form.
Currently, everything is working fine with one image upload with the following code:
<% @product.images.build if @product.images.blank? %>
<%= f.simple_fields_for :images do |img| %>
<% unless @product.images.first.file.blank? %>
<div class="control-group">
<label class="controls"><%= image_tag @product.images.first.file %></label>
</div>
<%= img.input :_destroy, :label => "Remove", :as => :boolean %>
<% end %>
<%= img.input :file, :as => :file, :label => "Picture", input_html: { class: "input-hundredpercent" } %>
<% end %>
However, how can I turn this nested form for multi image upload?
Image model is polymorphic and product model already has accepts_nested_attributes_for and it has images_attributes in attr_accessible.
I'm scratching my head in how to turn this into multi image upload and at the same time, showing the existing images.
--
You received this message because you are subscribed to the Google Groups "Hong Kong Ruby on Rails" group.
To view this discussion on the web visit https://groups.google.com/d/msg/hkror/-/yXzZdv-QkDwJ.
To post to this group, send email to hk...@googlegroups.com.
To unsubscribe from this group, send email to hkror+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hkror?hl=en.
--
You received this message because you are subscribed to the Google Groups "Hong Kong Ruby on Rails" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hkror+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/hkror?hl=en.For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to a topic in the Google Groups "Hong Kong Ruby on Rails" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hkror/RwrKChhVFx0/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to hkror+un...@googlegroups.com.