Sha256: e98fd4e96c508148dffa8a9f26b5a8f0e8a444231fc8b8d1afe742105c40bb79

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

= Nested Fields

nested_fields is an Engine designed for generic, dynamic nested forms which may be N>=1 levels deep.

Of what I could find, the existing solutions for dynamic nested forms in Rails are implemented with javascript rather through Controllers. It is my understanding that this is because FormBuilders cannot be passed as params to Controllers.

It does rely on some {parsing behavior}[http://guides.rubyonrails.org/form_helpers.html] within Rails which may or may not be intended for use in this manner.

== Requirements

Designed for Rails 3 applications.

jQuery is required. In the future, this requirement could be removed without much difficulty.

== Install

Add nested_fields to the Gemfile and bundle install.

== Usage

Include 'nested_fields.js' in the layout for the Add and Remove behaviors.

Use the nested_fields_for helper method.
  <%= nested_fields_for form_builder, :pluralized_association_name, 'path_to/inner_partial' %>

The same type of the form builder argument (e.g. Formtastic, SimpleForm, etc.) will automatically be used for the nested fields.

The <tt>nested_fields_ready</tt> custom event is fired after a nested fieldset is (dynamically or otherwise) added.

== Credits

Inspired by Ryan Bates' nested_form[https://github.com/ryanb/nested_form] which itself is based on Tim Riley's solution.

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nested_fields-0.3.0 README.rdoc
nested_fields-0.2.2 README.rdoc
nested_fields-0.2.1 README.rdoc
nested_fields-0.2.0 README.rdoc