Ruby on Rails 2.2 - some news (part 1)
The release candidate 2 of Rails 2.2 has been just announced. Let’s see some of the most interesting (IMHO) news.
Documentation
Personally I often use gem server to browse through classes documentation, but sometimes a more homogeneous “guide” could help a lot.
A new Rake task is added:
$ rake doc:guides
it generates the new Rails guides under doc/guides. These, still a work in progress, cover all the (basic) aspects of the framework:
- Getting started with Rails
- Rails Database migrations
- ActiveRecord associations
- Layouts and rendering with Rails
- ActionView form helpers
- Rails routing from the outside in
- Basics of ActionController
- Rails caching
- Testing Rails applications
- Securings Rails applications
- Debugging Rails applications
- Benchmarking and profiling Rails applications
- The basics of creating Rails plugins
More, the graphical appearence is (very) nice:

Multithreading
Now Rails is thread-safe (especially in waiting for Ruby 1.9 release), obviously “the whole thing” depends on sever infrastructure you deploy it.
Anyway it is now possible to enable multithreading dispatching simply putting:
config.threadsafe!
in config/environments/production.rb file.
ActiveRecord
The facility of connection pooling is introduced for database requests: a restricted set of database connections reused among different requests. To enable it insert the following configuration directives in config/databases.yml:
development:
...
pool: 10
wait_timeout: 5
More, the new method ActiveRecord::Base.connection_pool allows direct access to the pool.
Now it is possible to spcify joins conditions using an hash:
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
Post.find(:all, :joins => :comments, :conditions => {:comments => {:approved => true}})
Conclusion
Obviously a lot of other work has been done, you can read more about it on official announcements.
