Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Adds fields_for_with_template method for use in views where JS is used to add/remove fields

tag: rails2.3

Fetching latest commit…

Cannot retrieve the latest commit at this time

README
Actionview-fieldsForWithTemplate
================================

Adds the following view helper for work with nested attributes:

  fields_for_with_template

This requires NumericSequence, available at github.com/mhs/numeric-sequence.

Example
=======

  <% @provider.schools.build 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...
  </div>
  
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

Something went wrong with that request. Please try again.