ryanb/nested_form — pull request #235 by mhuggins (2013-02-09 16:20:16+00:00)
Title: Allow DOM target to be specified when adding new nested form elements

These changes allow nested form elements to be appended to any DOM element rather than just inserting before the link. This is useful when you're adding to a `TABLE`, `UL`, `OL`, or any other element that does not share the same parent as the `add_to_link`.

Example usage:

%table
%thead
%th
%td Ingredient
%td Quantity
%td Unit
%td
%tbody#ingredients
=f.fields_for :recipes_ingredients, wrapper: false do |i|
%tr.fields
%td= i.input :ingredient_id, label: false, collection: Ingredient.order(:name)
%td= i.input :quantity, label: false
%td= i.input :unit_id, label: false, collection: Unit.order(:name)
%td= i.link_to_remove 'Remove'
%p= f.link_to_add 'Add Ingredient', :recipes_ingredients, target: 'ingredients'