Living on the Edge (or what's new in Edge Rails) #3
Posted by Chu Yeow July 06, 2008 @ 06:32 AM
There hasn’t been much of note in terms of big changes or features in edge Rails lately, so this time I’ll leave you to pore over the Rails commit logs for any bug fixes or minor changes that I haven’t pointed out. There has been some work in progress with ActionPack refactoring and multithreading work as well as some activity in ActiveModel too, but nothing really concrete yet (still very much a work in progress).
As usual, be sure to leave any suggestions and criticisms in the comments.
Thin support with script/server
script/server now checks for the availability of Thin and uses it. Pretty convenient if you are using Thin as your production server (and want to run the same when developing). You’ll have to add config.gem 'thin' to your environment.rb first to get this to work.
This patch was contributed by one of the guys at fluxin.
String#humanize can be customized via inflection rules
The String#humanize core extension method is used convert strings with underscore, usually table column names, in them to pretty readable text. For example,
"actor_salary".humanize
=> "Actor salary"
"anime_id".humanize
=> "Anime"
Sometimes this doesn’t work out so well though, when you have legacy tables or simply “inhumanely” named column names like “act_sal_money” (which is really “Actor salary”, but would be #humanize-d to “Act Sal Money”).
You can now specify custom inflection rules (just like you would for plural/singular/irregular/uncountable inflection rules):
Inflector.inflections do |inflect|
inflect.human /_cnt$/, '\1_count'
inflect.human 'act_sal_money', 'Actor Salary'
end
Notice how you can also use a regular expression above to convert columns like “click_cnt” to “Click count”.
Thumbs up to Dan Manges and Pascal Ehlert for this patch.
Allow conditions on multiple tables to be specified using hash.
Pratik has committed a tiny (but really useful) change to ActiveRecord that allows you to specify conditions on a joined table in its own hash. An example would explain it better:
Anime.all(
:joins => :character,
:conditions => {
:active => true,
:characters => { :gender => 'female' }
}
)
The ActiveRecord query above would find all “active” anime with “female” characters.
Outro
That’s it for this week’s Living on the Edge – do let me know if you like to see more write-ups on even the minor bug fixes and changes that’d I’d left out this week.

yes ! i would really like to see more of the edge side of live ! regards
Thanks for the write-up, mate!
And please, do keep them coming. The more details, the better!
One huge new feature is Scott Barron’s acts_as_state_machine, which appears to be incorporated into Rails now:
http://github.com/rails/rails/commit/b9528ad3c5379896b00772cb44faf1db0fd882d7
Geoffrey, the AASM work doesn’t yet appear to be stable enough to talk about. The readme (http://github.com/rails/rails/tree/b9528ad3c5379896b00772cb44faf1db0fd882d7/activemodel/README) seems to make it clear that it’s still an experiment, though I suspect that will change at some point.
Yes! I would like to see: D
ненененне. Дэвид Блэйн!
A commenter in Ars Technica’s site is saying that new enterprise tools from Apple are being done in Ruby on Rails!
Apple releases iPhone Configuration Utilities for business http://arstechnica.com/journals/apple.ars/2008/07/10/apple-releases-iphone-configuration-utilities-for-business
(I did not find a place to “send news”)
Totally offtopic, just want to mention :). Discovered right now. Apple released an iPhone Web Configuration Utility, which is implemented as a Rails Application :).
Link: http://www.apple.com/downloads/macosx/apple/application_updates/iphoneconfigurationwebutility10formac.html
I would like to see as really more of the coast live too.
Thanks for the details, keep it coming!
http://www.neonrain.com/blog/