Fetching contributors…
Cannot retrieve contributors at this time
26 lines (16 sloc) 817 Bytes
Adds the following view helper for work with nested attributes:
<% if @provider.schools.reject(&:marked_for_destruction?).empty? -%>
<% f.fields_for_with_template :schools do |school_form| %>
<%= render :partial => "school", :locals => { :form => school_form } %>
<% end %>
This will produce an additional template element containing the body of the fields for, ie:
<div class="template">
... whatever render :partial => 'school' produced...
It will replace all ids or counters with "NEW_RECORD". You need to supply the JavaScript to handle add, removing, etc, given this.
Copyright (c) 2009 Mutually Human Software, released under the MIT license