Rails 2.2: i18n, HTTP validators, thread safety, JRuby/1.9 compatibility, docs
Posted by David November 21, 2008 @ 05:22 PM
Rails 2.2 is finally done after we cleared the last issues from the release candidate program. This release contains an long list of fixes, improvements, and additions that’ll make everything Rails smoother and better, but we also have a number of star player features to parade this time.
Internationalization by default
The most important is that Rails now includes a full-on internationalization framework and that it’s pre-wired from start. The work of the i18n group has been very impressive and it’s great to see that Rails finally ships with a solution in the box that’s both simple and extensible. Great job, guys!
Stronger etag and last-modified support
We’ve also added much better support for HTTP validators in the form of etag and last-modified. Making it so much easier to skip expensive procesesing if the client already has the latest stuff. This also makes it even easier to use Rails with gateway proxies.
Thread safety and a connection pool
Josh Peek has added thread safety to Rails and Nick Sieger from JRuby worked on getting Active Record a proper connection pool. So now all elements of Rails are thread safe, which is a big boon for the JRuby guys in particular. For C Ruby, we still need a bunch of dependent libraries to go non-blocking before it’ll make much of a difference, but work on that is forth coming.
Ruby 1.9 and JRuby compatibility
Jeremy Kemper has been rocking on both Ruby 1.9 and JRuby compatibility. Rails 2.2 is fully compatible with both, but again, there might be supporting libraries and gems that are not. Again, lots of work is going into making everything else fully compatible as well.
Better API docs, great guides
Finally, the last big push has been with the documentation of Rails. Pratik’s docrails project has made immense progress. Not only are the API docs much improved, but we also have a whole new guides section generated from documentation that now lives with the source. A true community project with lots of contributors. I’m sure both those new and old to Rails will greatly appreciate the strong focus on documentation.
To read about all these features and more in details, checkout the Rails 2.2 release notes—another one of those guides from the docrails project.
How to install
As always, you can install Rails 2.2 through RubyGems. We now require RubyGems 1.3.1, so be sure to update that first: gem update --system
Then you can install Rails: gem install rails
If you’re updating an existing application, you can run rake rails:update to get the latest JavaScript files and scripts.
From all of us to all of you, we hope you enjoy this release. It’s a true pleasure to see Rails make such big steps forward once again. Dig in, have fun, and we’ll be back with Rails 2.3 with even more before you know it.




cool ;)
A big thanks to the core team and all contributors!
Woohoo! Congratulations!
I’ve been trying out 2.2 this week on one project, and enjoyed what i’ve seen.
Now roll on 2.3 (or 3.0) because i cannot wait for default_scope and new-improved partial rendering! :)
congrats to you all! thanks for all your work.
A hundred million thank you’s to the ever growing number of contributors in both features and documentation. Here’s to the best version yet… and on to the next!
Awesome. bitsweat, dhh and nkoz, in the name of the rails i18n team, lemme thank you for finally making this possible.
Sweet! :-)
cool!
Sweet! Looking forward to Array#forty_two ;)
Great news David and team.
Congratulations on the release. Rails has sure come a long way from when I first started using it 4 years ago.
Don’t know what my favorite features is: internationalization or thread safety.
Nice work guys !
Great !
I’ve been following/trying the RCs, … for weeks. It’s so good to have a finished/polished product to use.
Thanks everyone
Congrats to all, tremendous advances indeed
Thanks, I’ll really enjoy the internationalization.
“We now require RubyGems 1.3.1, so be sure to update that first: gem update—system”
$ sudo gem update—system Password: Updating RubyGems Nothing to update
$ gem -v 1.2.0
Even having v1.2.0 only I could manage to install the gems.
How come it does not appear to be an updated version of RubyGems?
I wish for a 2.2.2 tag at github
From the RubyGems post-update-to-1.3.1 message (which is a bit late if you’re having trouble upgrading):
NOTE: RubyGems 1.1 and 1.2 have problems upgrading when there is no rubygems-update installed. You will need to follow the second set of update instructions if you see “Nothing to update”.
NOTE: You may have to run the command twice if you have any previosly installed rubygems-update gems.
If you have an older version of RubyGems installed, then you can still do it in two steps:
Myers, as you asked: http://github.com/rails/rails/tree/v2.2.2
Congratulations on the release. Thanks everyone for all your work.
Thanks to the entire Rails team and everyone who contributed to the process in any way. Exemplary work, and keep it up … really looking forward to Rails 2.3/3.0 and the finaly Ruby 1.9 release so that we can continue on into the future!
Awesome! I8n and thread safety are awesome improvements. I’m looking forward to 2.3/3.0 Hopefully I actually contribute to those!
Great!
Yes. i18n is very cool for our project. Now I am going to gem update—system !!
Awesome stuff as usual. Congrats!
WIN!
very cool!
Question. What is the big advantage with thread safety? Does this mean with Rails 2.2 that you don’t have to fire up X rails processes (each loading everything needed in their own memory space)? One of my biggest complaints with rails is that it hogs memory. On my server, 4 mongrel processes (yes, I know mogrel is soo 2006) takes ~400MB. What improvements over this (if any) should I expect by upgrading to Rails 2.2?
Temujin, if you’re looking to save on memory, your best bet is probably going to be Passenger + REE. They use copy-on-write memory management that can really cut down on memory usage when running many instances of the same app.
The JRuby guys have similar advantages with using thread safety.
Using thread safety with C Ruby isn’t going to give you that much yet. There are still too many things blocking to have a single process with 4 threads replace 4 processes without threads.
Nice work guys!
I wrote a small rake task that can check for missing translations for your Rails 2.2 apps. Currently it doesn’t do interpolation properly, but that is the plan!
http://frozenplague.net/?p=346
Nice work on 1.9 compatibility!
Great job on the release. With i18n, Rails finally is an option! Thanks!!!
Thank you. As always, I get very excited, not like for example watching Apples new products this year ;-)
I am so looking forward and I will get even more excited with the next biiiig step: Ruby 1.9 and 2.3 / 3.x of Rails.
Wish you a lot of phun and kick back for your work, ... for all of you!
Thnx
Awesome. Rails is so awesome.
About the blocking issue: isn’t it just the database driver and IO, which is blocking?
Great work! Now, has anyone firgured out how to successfully install Mongrel with Ruby 1.9.1 and Rails 2.2? I’m running into trouble with fastthread…
For me I18n was the missing default feature from rails to become really mainstream.
Great work!
Thank you!
Thanks for the release. I ran into trouble with MySQL. I got a message saying to install the mysql gem manually, so I did. It installed ok, but my app couldn’t find it, even after restarting everything. I tried starting it again the next morning and it worked. I suppose I forgot to reset something.
Thanks for all the hard work guys!
When I started my recent project, it was on 2.0.2 You guys are too fast!
Yeehaaw…Great job guys! I am not patient to try this version.
太好了,祝贺祝贺
great! Thanks guys!
Looking for to be using and learning from the new features. Thank you for your efforts!
I’ve problem with MySQL. ”!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.” I’ve any idea. I’ve properly installed MySQL and Rails as mentioned on: http://danbenjamin.com/articles/2008/02/ruby-rails-leopard
I work on Mac OS X 10.5.5.
All my applications work properly in Rails 2.1
Be sure to update your Rails environment.rb in:
if you’re migrating from Rails bundled as submodule in vendor/rails…
On Mac OS X 10.5 (Leopard) I’m getting errors that Rails can’t find sqlite since upgrading to 2.2.2 (it was working fine under 2.1.2). I have been on rubygems 1.3.1, have sqlite3-ruby, etc all installed. The only thing that I changed this morning was to sudo gem update rails to 2.2. Any ideas why Rails can’t find sqlite now?
MissingSourceFile (no such file to load—sqlite3)
rails (2.2.2, 2.1.2, 2.0.2) rails-app-installer (0.2.0) sqlite3-ruby (1.2.4)
which sqlite3 => /usr/bin/sqlite3
I’ve resolved my problem with : ”!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.”
The solution is here: http://wonko.com/post/how-to-install-the-mysqlruby-gem-on-mac-os-x-leopard
I’ve had the wrong version of mysql package – x86_64 is wrong. Should be x86 … so now everything is ok.
Thanks guys!
Props go out to all contributors! The new additions are awesome and it’s great to see things continue to get better.
@Nicholas
I’m seeing the same problems loading sqlite3 after performing the Rails upgrade. It doesn’t seem to be isolated to Rails though:
$ gem list | grep sqlite3-ruby sqlite3-ruby (1.2.4) $ irb irb(main):001:0> require ‘rubygems’ => true irb(main):002:0> require ‘sqlite3’ LoadError: no such file to load—sqlite3 from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’ from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require’ from (irb):2 irb(main):003:0>
Anyone else? Link? Thanks!
Guys – thank you!
I’m running into a problem with new projects. I get the message that Rails requires 1.3.1 but I have 1.2.0 installed. Gut $gem -v indicates I have 1.3.1 installed. I used your suggestion to: $ gem install rubygems-update $ update_rubygems
and I follow up with
$gem update—system.
But to no avail!!
I still get the error in Netbeans and the only way around is to use rails 2.1.0.
Any suggestions?
got a problem with REE and Passenger right after I’ve updated to Rails 2.2.2.
Now it seems like the package manager does not recognize Rails 2.2.2 to be installed.
I’ve wrote a message and described the problem on the Google Groups page: http://groups.google.com/group/emm-ruby/browse_thread/thread/2ad5d826b8988fb0#
I hope someone will know the solution to my problem. Thanks in advance,
Attila
Thank you everyone! Rails 2.2 is great! I’ll check it out right now…
@Nicholas, @Maxwell,
I had the same problem, and while I doubt this is supposed to be necessary, this fixed it:
config.gem ‘sqlite3-ruby’, :lib => ‘sqlite3’
(in environment.rb)
congrats!
wow thanks sam! your solution worked perfectly. I wonder if its ok if i modify the gem files directly so that i wont have to do it to all my rails apps running on sqlite
do_sqlite3-0.9.7 —this gem is installed by Merb, and for some reason it doesn’t play well with Rails 2.2. I have removed it and I no longer get sqlite not found errors, but if I put it back the error returns. I tried Sam’s suggestion and it works too – now both Rails and Merb play in the same sandbox ok. Thanks for that tip!!
Thanks @SamSM and @Nicholas. I also found a link to a ticket in the Datamapper project re: problems with do_sqlite3 and sqlite3-ruby:
http://wm.lighthouseapp.com/projects/4819/tickets/660-require-sqlite3-fails-with-do_sqlite3-097
I am amazed at how quickly this community works!
I seriously believe you guys are the fastest of all the development efforts, both open source and commercial, worldwide.
Please, don’t sell out! When Amazon (or the myriad of other potential buyers) tries to finally buy you out, SAY NO!
Apple, Adobe and Microsoft take note!
I approve that do_sqlite3 gem removal brings things back to normal :-)
Thank you to everyone that contributed to the release!
Congratulations to the Rails team and collaborators!
Congratulations to all involved.
Well done team!
Excellent, thank you very, very much! Congratulations to the team!
Thanks!
Great!
@David
gem install rubygems-update update_rubygems
Should get you up and going.
:)
:)
Thanks!
Just found this after working years with .net. Really amazing how fast you can develop on rails.
I have been long waiting for rails 2.2 especially i18n, I just hope our current app can be upgraded to rails 2.2 streamlessly. That is upmost wish feature for us (our chinese apps)
Thanks guys!
congrats to you all! thanks for all your work.
I can’t install Rails 2.2.2 on one of my servers. With Rails 2.1 installed, gem update gets rails 2.1 again. Running:
gem install rails -v2.2.2
And I still get rails 2.1.0.
Been Googling around for a while, but I haven’t found what the problem might be.
gem sources => http://gems.github.com/ http://gems.rubyforge.org
Any ideas?
I found the weirdest bug. In 2.2.2 erb will no longer interpret the first line of your template if it starts with ’%’. I start all my templates with % @title=’...’ so to upgrade I will have to add a newline to all template files in all my projects :-(
Great job, guys!
I got huge problem with mysql connetion! I can’t install mysql gem under vista! Always an error like “C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so” apears… Anyone an idea??
In case any of your are having sqlite3 1.2.4 issues try reverting to version 1.2.3. I was having problems with 1.2.4.
I guess sqlite3 1.2.4 lacks win32 support from what I read on a blog. I kept getting a nmake errors after I upgraded all my gems and it was pissing me off and took me like an hour or two to find someone who experienced the same thing.
a new version of do_sqlite3 (0.9.8) seems to have fixed the problem. now it is working fine..
Could it be that a freshly generated app is missing “scriptaculous.js”?
On updating rubygem: I have NEVER been able to get gem upgrade—system to work on versions prior to 1.3.0. If your version is earlier, you may well need to grab the tarball from sourceforge, unzip, untar, and run the install script.
I had rails 2.2.2 installed before this rails 2.2 was released. I thought 2.2.2 was a RC (Release Candidate)
So now when I install rails it does nothing.
If I uninstall all rails 2.2.x and reinstall it only replaces the rails gem not any of the supporting cast (Active* and Action*).
So if you installed 2.2.2 before 2.2 was released is there a special upgrade path?
So is 2.2 really 2.2.2?
Why didn’t you bump the version number from the RC so it would be a clean install, and give us peace of mind?
Color me confused.
If you are having problems with MySQL, getting errors like: “The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.” “C:/ruby/lib/ruby/gems/1.8/gems/mysql-2.7.3-x86-mswin32/ext/mysql.so”
Here is the solution: 1) First, gem install mysql. If this doesn’t help continue… 2) Copy libmysql.dll from InstantRails (see below) to your mysql directory (C:\mysql\bin\). Restart your computer and it should be working.
InstantRails libmysql.dll: http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/
Hope this helps…
On Nov 22, David asked about a problem in Netbeans with the old GEM version showing up. You probably solved it, but I went to Platform Manager, created a new platform, and picked my /usr/local/bin/ruby interpreter. Once I did that, the new GEM 1.3.1 and all my updated gems showed up in the Netbeans Gem Manager. Good luck, Charles
I update my gem and my rails version but when i run script/server appears the following error: ... `report_activate_error’: Could not find RubyGem rack (~> 0.4.0) (Gem::LoadError) ....
What i have to do??
Margaret I had the same problem, i used rails gem:freeze and my rails version was showing 2.3.0… i just remove frozen rails and used system 2.2.2 and it works fine.
hope that helps..
For updating NetBeans 6.5 to the latest gem run the following:
cd /Applications/NetBeans/NetBeans\ 6.5.app/Contents/Resources/NetBeans/ruby2/jruby-1.1.4/ bin/jruby -S gem install rubygems-update bin/jruby -S update_rubygems
Thanks Guys… I already installed it…. waiting to startoff ;)
Is anyone else getting associations not found on the second hit? It works the first time, then breaks the second time.
rails really look awesome, great work guys. hey, can you tell me what textmate theme are you using on new weblog demo? i thought it very beautiful.. thanks
is there a way to get the FormBuilder.label helper to translate my model attributes?