Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Adds fields_for_with_template method for use in views where JS is used to add/remove fields
Ruby
branch: rails-2.1-attr…

This branch is 3 commits ahead, 3 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

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.