Skip to content

Instantly share code, notes, and snippets.

@designium
Created June 14, 2012 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save designium/2930247 to your computer and use it in GitHub Desktop.
Save designium/2930247 to your computer and use it in GitHub Desktop.
Nested form
<% @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 %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment