Topic: Support a Railscast-inspired patch

Ryan's latest screencast does some impressive stuff with forms. During this epsiode he complained that a certain hash was not very pretty and quite repetitive.

Here is a snippet to illustrate the problem

<% 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, :class => 'should_destroy' %>
<% end %>

Notice the repetitive usage of :index => nil in those field inputs...yuk!!!

Fortunately, another Ryan(McGreary) came to the rescue with a great patch for Rails core that would take the above code and turn it into

<% fields_for "project[task_attributes][]", :index => nil task do |f| %>
  <%= f.text_field :name  %>
  <%= f.hidden_field :id %>
  <%= f.hidden_field :should_destroy, :class => 'should_destroy' %>
<% end %>

Soooo much better. Its a small change but I think its one worth supporting. If you find this patch as useful as I do, head on over to rails dev and +1 your support. It takes 3 votes to submit a proper patch, so lets show some love!

Here is the link:

Re: Support a Railscast-inspired patch

i've voted even if i don't see any problem with one method argument smile