Rails is now fully compatible with Ruby 1.8.2, which we advice all to upgrade to as soon as possible. It contains a year’s worth of bug fixes for Ruby, so it’s great finally to be able to use the new version with Rails. But that is not all we got in store for 0.9.3. A few of the highlights are:
- Automated optimistic locking: Just add the field
lock_versionto your table and the associated class will be governed by optimistic locking that’ll raise an exception if a stale object attempts to save.
- Dynamic finders: Finders like
Payment.find_by_amount, and even
Person.find_by_user_name_and_passwordare now available with no code at all. Any column can be used and combined with other columns in the new dynamic finders.
- MS SQL Server and DB2: Active Record now supports both Microsoft SQL Server (through ADO) and IBM’s DB2 databases.
- MemCacheStore for sessions: You can now store sessions in Action Pack using Danga’s memcache technology.
- Generators guard against reserved words: Not only will
./script/generate model Threadbe denied, you’ll also get a list of synonyms pulled live from WordNet!
Upgrading from Rails 0.9.2 to 0.9.3
There’s only one change you need to make in order to have your application updated from 0.9.2 to 0.9.3. In the config/environments/production.rb and config/environments/test.rb, you need to change:
ActionController::Base.reload_dependencies = false ActiveRecord::Base.reload_associations = false
Dependencies.mechanism = :require
And in config/environments/development.rb, you need to change:
ActionController::Base.reload_dependencies = true ActiveRecord::Base.reload_associations = true
Dependencies.mechanism = :load
If you’re coming on from 0.8.x, you’ll need to go through the Upgrading to 0.9 manual.