What's New in Edge Rails #17
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 anindex
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
orbelongs_to
in migrations. That's nice; it would have saved me typingadd_index
about eleventy-seven times by now.