%= nested_form_for(@template, :html => {:multipart => true}) do |f| %> <% if @template.errors.any? %>
<%= f.file_field :thumbnail %> <%= f.hidden_field :thumbnail_cache %>
<%= f.fields_for :previews do |p| %> <%= p.file_field :image %> <%= p.hidden_field :image_cache %> <%= p.link_to_remove "Remove this file" %> <% end %><%= f.link_to_add "Add a file", :previews %>
<%= f.file_field :template %> <%= f.hidden_field :template_cache %>