Ryan Bates' screencast #75 touches on an approach for handling multiple objects with one form. This approach yielded a snippet like the following:
<% fields_for "project[task_attributes][]", task do |f| %>
<%= f.text_field :name, :index => nil %>
<%= f.hidden_field :id, :index => nil %>
<%= f.hidden_field :should_destroy, :index => nil %>
<% end %>
He mentioned that the :index => nil options were ugly, and I agree. I thought it would be nice to be able to pass the :index option to the fields_for helper instead. For example:
<% fields_for "project[task_attributes][]", task, :index => nil do |f| %>
<%= f.text_field :name %>
<%= f.hidden_field :id %>
<%= f.hidden_field :should_destroy %>
<% end %>
This reduces the clutter and avoids the duplication. This patch adds support for this. It includes tests and some brief rdoc explaining the option.