Friday, February 13, 2009

This Week in Edge Rails

Posted by Mike Gunderloy

February 7, 2009 – February 13, 2009

It’s been a fairly busy week on the edge, but there are not a lot of new features to point at. That’s good: at this point in the release cycle, the team is concentrating on nailing down things to be solid even in strange circumstances. This is also the point at which your help is critical: if a change affects one of your applications, and you don’t tell anyone about it, you can’t expect a fix. You don’t need to be running your applications full-time on RC1, but please, check out edge Rails, try it out, and report anything that seems to be broken. Bonus points if you include tests to show the expected behavior, and super bonus points if you submit a patch to go with it.

View Rendering Changes

A series of commits have addressed some issues with view rendering. The end result is to improve the performance of view rendering in development mode, and to bring back template recompiling in production mode (so you can change a view and have the changes show up without having to restart the whole server). Some of this work is ported from rails-dev-boost and if you want to come up to speed on what’s been done here the best thing to do is read the Lighthouse ticket

Partial Scoping for Translations

A change to the translation API makes things easier and less repetitive to write key translations within partials. If you call translate(".foo") from the people/index.html.erb template, you’ll actually be calling I18n.translate("") If you don’t prepend the key with a period, then the API doesn’t scope, just as before.


Nested Attributes API Change

The API for NestedAttributes has been changed so as to work better with existing associations. If you’ve just used this for nested model forms, the changes will probably be transparent to you, but if you’ve been deeper into the internals you should have a look at the discussion in Lighthouse as well as the code in the commit.


Less Brittle Tests for Scaffolded Controllers

The automatically-generated functional tests for controllers generated with script/generate scaffold now use to_param instead of id to identify records, which should make them more resilient to changes in fixtures over time.


TimeWithZone changes

There were some internal changes to TimeWithZone that make its code more readable and efficient. One change surfaces to the API: TimeWithZone#to_formatted_s is an alias for TimeWithZone#to_s.


A New Inflection

Breaking a long-standing policy, there was actually a change to the built-in list of pluralizations this week: Rails now handles database/databases correctly. Remember, a foolish consistency is the hobgoblin of little minds, and please don’t take this as an invitation to reopen the old ticket 10919. The policy remains that you can add inflections in your own application’s initializers if you need to do so.