ryanb/nested_form — pull request #278 by sschildknecht (2013-07-13 00:00:18+00:00)
Title: Allow custom wrapper selector

Nested_form assumes that the element wrapping the blueprint has `class=".fields"` by default. As this may conflict with existing css, the following may be used to add a custom wrapper selector:

```erb
<%= nested_form_for @task do |f| -%>
<%= f.text_field :name %>

<%= f.fields_for :milestones, :wrapper => false do |milestone_form| %>

<%= milestone_form.text_field :name %>
<%= milestone_form.link_to_remove "Remove" %>

<% end %>

<%= f.link_to_add "Add new milestone", :milestones,
"data-target" => "#tasks",
"data-selector" => ".milestones-wrapper" %>

<% end %>
```
If no custom selector is given, ".fields" is used. After rendering the blueprint, addFields or its prototype equivalent adds a `data-nested-wrapper` attribute to the wrapper so the remove links can find the wrapper, as they did with ".fields" previously.

Implemented for the prototype and jquery variants along with specs.
Readme is updated, too.