Rails 2.2 Released – 27 Links and Resources To Get You Going
Ruby's most popular Web application framework, Ruby on Rails, takes another giant step today with the release of Rails 2.2! It follows on just five months after Rails 2.1, but offers even more significant improvements, particularly in the areas of compatibility, internationalization, and documentation. Read David Heinemeier Hansson's release post for a quick overview.
Ruby Inside's sister site, Rails Inside, was launched alongside Rails 2.1 in June, and would, you'd think, be the ideal place for a post like this, but no. Rails is very significant to the Ruby world as a whole, so you'll still get the biggest of the biggest Rails announcements here on Ruby Inside! If you want more regular Rails-only news, however, go and subscribe to Rails Inside (RSS feed or e-mail subscription).
As is typical for a big release, we've pooled together a ton of excellent resources, links, and what not, to help you get fully into the Rails 2.2 mindset. So if you've got Rails 2.2 running already or if you're just investigating what it could do for you, read on and investigate some of these resources.
General Documentation and Guides
Rails 2.2 Release Notes - A very solid set of release notes for 2.2 with basic coverage of the new features (with short code examples and links) as well as a list of deprecated features. They were compiled by Ruby / Rails Inside's very own Mike Gunderloy!
Upgrading RubyGems to 1.3.x - Depending on your setup, Rails 2.2 may demand that you upgrade to RubyGems 1.3.x. This is not as easy as it might usually be, however. Mike Gunderloy gives some tips in case you get stuck.
Rails Security Guide - Steer clear of security issues in your Rails 2.2 applications by reading the Ruby on Rails Security Guide. Who said Rails has poor documentation? This is incredible!
Rails 2.2 Screencast - Gregg Pollack and Jason Seifer of Rails Envy put together a very solid Rails 2.2 screencast. It costs $9, but it covers a lot of ground over 44 minutes - learn about etags, connection pooling, new enumerable methods, new test helpers, and more.
Rails 2.2 - What's New - In association with EnvyCasts, Carlos Brando and Carl Youngblood present Rails 2.2 - What's New, a 118 page PDF covering all of the changes and additions to Rails 2.2. It's available in a package deal with the screencast (above) too.
InfoQ's Glance - InfoQ's Mirko Stocker takes a quick glance at some of Rails 2.2's new features.
New Features
Thread Safety - Rails 2.2 is now "thread safe." In October, Pratik Naik wrote a summary of why this is a big deal as well as some gotchas (basically, don't use class variables, use mutexes, etc.) Charles Nutter has also written What Thread-safe Rails Means which answers several pertinent questions.
Internationalization - The Rails Internationalization effort has its own homepage at http://rails-i18n.org/ which features lots of links to how-tos, tips, documentation, and demos. They also have a Google group / mailing list where you can get help, make suggestions, etc.
Basic Language Internationalization - It's a little old, but Simple Localization in Rails 2.2 gives a very quick, code-driven example of how basic internationalization works in Rails 2.2 (some of the set up is easier now, but it mostly applies).
Localization / Internationalization Demo App - Clemens Kofler has put together a demo app that shows off some of Rails 2.2's internationalization and localization features. If being knee deep in code is the best way for you to learn, jump in!
Layouts for ActionMailer - As of Rails 2.2, you can now use layouts in your ActionMailer views.
Connection Pooling - The connection pooling in Rails 2.2 allows Rails to distribute database requests across a pool of database connections. This can cause less lockups. In collaboration with a non-blocking MySQL driver, serious performance increases could result in certain situations.
Specify Join Table Conditions with Hashes - Do you need to run a find (or similar) query across a join? Now you can just specify the conditions for the joined tables in a hash, much like local tables conditions!
Limited Resource Routes - You can now limit map.resources to creating certain methods. For example, you might not want destroy or index methods - you can now specify these with :only and :except.
Memoization - Stop rolling your own memoization in Rails apps. Clemens Kofler demonstrates Rails 2.2's newly rolled-in memoization features. It's just a single method! If you have a view that calls on a calculated attribute often, this will give you some serious performance gains.
Custom Length Tokenizer for Validations - You can now specify a tokenizer of your own construction for validates_length_of validations.
Array#second through Array#tenth - If you're a bad programmer, you can now demonstrate it to the world by using the new Array#second, Array#third, Array#fourth, and so forth, methods. I've put it in my calendar to look for open source Rails apps using Array#seventh in six months time and to call them out on Rails Inside ;-)
Note: This list only takes into account some of the new features in Rails 2.2. There are a lot more! Read the release notes and the Rails 2.2 - What's New PDF to get the full picture.
Miscellaneous
restful-authentication-i18n - Want an authentication plugin for Rails 2.2 that supports internationalization? Take a look at result-authentication-i18n!
Barebones Apps - Check out Rails Inside's 7 Barebones Rails Apps to Kick Start Your Development Process.
Deploying on JBoss - You can now easily deploy a Rails app to a JBoss server. With Rails 2.2's significantly improved JRuby support, this makes rolling out Rails apps in the enterprise a breeze!
Installing Rails on Ubuntu Hardy Heron - Simon St Laurent has put together two Rails useful installation videos. One for servers, and one for the desktop.
REST for Rails 2 - Are you still in Rails 1.x land or not using REST at all? Would you like to? Geoffrey Grosenbach has put together a screencast showing you how it should be done. (Disclaimer: Peepcode is a sponsor of Ruby Inside.)
A Better Rails Logo - The Rails Logo (as used at the head of this post) was created by Kevin Milden and is distrubuted under the BY-ND Creative Commons Licence. This makes it a lot cooler than the "official" Rails logo which is trademarked and, well, you can't use without getting approval from the top.
Got more? Leave a comment below. On posts like this, the comments get a lot of clicking love from readers eager to learn more - so feel free to promote your own Rails 2.2 related stuff :-)
November 22, 2008 at 6:33 am
Great resource! Really useful links! Thank you very much.
But weren't gem dependencies a feature of Rails 2.1?
November 22, 2008 at 6:35 am
D'oh! You're right - thanks. I've been using edge too long :)
November 22, 2008 at 10:50 am
Thanks for mentioning the security guide. I've also done a compact PDF: http://www.rorsecurity.info/the-book/
November 22, 2008 at 4:30 pm
A last-minute commit removed sixth through tenth and added forty_two.
So you may have a difficult time with your contest, Peter!
http://github.com/rails/rails/commit/e50530ca3ab5db53ebc74314c54b62b91b932389
November 22, 2008 at 4:38 pm
Oh, man! :) Fine, fourth it is. Admittedly, that'd be slightly less of a code smell, but I think it'll count.
November 22, 2008 at 11:44 pm
restful-authentication-i18n is mis-spelt as result-authentication-i18n.
November 23, 2008 at 7:02 am
Array#second through Array#tenth
it isn't the feature of the Rails2.2
>> arr = [1,2,3,4,5,6,7,8,9,10]
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>> arr.first
=> 1
>> arr.second
=> 2
>> arr.third
=> 3
>> arr.fourth
=> 4
>> arr.fifth
=> 5
>> arr.sixth
NoMethodError: undefined method `sixth' for [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:Array
from (irb):7
it's Rails edge feature
November 23, 2008 at 12:07 pm
Alex: It was, but it was changed at the last minute. See Geoffrey's comment above.