Well, finally it’s there, many important improvements were added to rails 2.2, and yet new things are on the way, you can check this blog post to check what’s new, while i’m gonna list here what i really liked about the new version of rails 2.2:
If you really don’t know what it means, then most probably you want to check this post by Charles Nutter, however in short terms: threaded rails with a native threaded implementation of ruby (jruby in our case) will save your memory , make your app more scalable, and most importantly it will make the app deployment very easy, specially when glassfish gem or even with jetty-rails gem is used.
And you Just have to make sure your app is thread safe, follow this post by Pratik Naik.
So many people complained about this point before, but this a fact is from past now 🙂 , just fire your terminal , go to ur app path, and run :
This will create doc/guides in your project root , with a comprehensive rails guide to learn from.
Internationalization or I18n
A support for i18n is there now, so you don’t have to install any extra gem or plugin, a comprehensive demo is put there, just be aware that you don’t need to install the plugin when following the demo, cause it’s already there in rails 2.2 .
Also check the I18n screencast by Ryan Bates.
Performance + JRuby compatibility
- Connection pooling is added in this version of rails , which will save the time of opening(open connection with the db server +authentication) and closing the connection for each http request, so now a pool of connections will be used to serve incomming http requests, instead of opening a new connection for each request.
- There were efforts to enhance the erb system , which will affect the rendering process time.
- Rails 2.2 is fully compatible with JRuby which is the fastest ruby implementation at the current moment, and that will give you better performance when JRuby is used ,specially that the JRuby team is continually and actively(a release every 3-4 weeks) working on optimizing the overall performance and for rails usage as well.
- Memoization term was introduced to cache values, check this screencast by Ryan Bates.
- ETags and saving your server the hassle : if u don’t know about ETags then it’s time for that , check this post by Ryan Daigle.What matters here is that the new support from rails to ETags will give you 2 enhancements :
- Frontend enhancement: the client browser will use it’s cache to render the needed data and thus won’t need to issue a new request to your server to bring the data, thus a faster rendering on client side.
- Backend enhancement: your ror servers won’t need to handle some logic to respond back to your client browser requests, thus free the processor to handle other logic.
- Template views will be cached now for production mode.
Caching actions without their layouts
Now it’s possible to cache an action without it’s corresponding layout:
class HomepageController < ApplicationController
# Just pass the param layout with false value
caches_action :feedback, :layout => false
This is really cool, cause in many cases our layout will contain some info related to user status in the website.
More additions might be very interseting for you
As for me, those enhancements and additions listed above , where the most benifitical for my work, other things might attract your attention, for more information about what’s new, i strongly urge you to look at Ruby on Rails 2.2 PDF by By Carlos Brando.