A fix in disguise for titleize
Posted on June 8th, 2008
Rails 2.1 was released last week at RailsConf with a lot fanfare and sexy features like timestamped migrations, named scopes and better timezone handling. There was also a minor fix that I was happy to see: String#titleize now works with acronyms. Prior to 2.1:
>> "ALS community".titleize
=> "Als Community"
Not terribly desirable that "ALS" suddenly has lowercase letters because it's used in a title. But now in 2.1:
>> "ALS community".titleize
=> "ALS Community"
Ah, much better. I had patched String in my projects to correct this. Now the band-aid can come off. Interestingly, it looks like this bug was not reported (shame on me); instead the fix was made in response to an issue where the character following an apostrophe was being incorrectly capitalized:
>> "frog's code".titleize
=> "Frog'S Code"
The change to address this case also solves the acronym problem. Details of the fix can be found here:
One Response
A impressive publish, was fine performance it, cheers…