Week of April 8 - April14, 2012

Lots of tidying up in the Rails source this week. It's amazing how much even a mature codebase can be improved when lots of people are nibbling away at it.

  • 1a20683f adds enough relations to NullRelation to make it chainable with database methods, so you can use Post.none anywhere you could use Post.all.
  • The FormBuilder class gets an index method in 47cbfbb9. Here's the sample usage from the commit:

<%= form_for @person do |person_form| %>
  ...
  <%= person_form.fields_for :projects do |project_fields| %>
    Project #<%= project_fields.index %>
    ...
  <% end %>
  ...
<% end %>
  • 1bac04e85 optimizes the performance of #delegate. It's a mildly-breaking change, though, in that you can no longer delegate to private methods.
  • With ca0af822, you get an automatic index when using references or belongs_to in migrations. That's nice; it would have saved me typing add_index about eleventy-seven times by now.