BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Rails 2.3.2 Arrives with Many Updates

Rails 2.3.2 Arrives with Many Updates

Leia em Português

This item in japanese

The Ruby on Rails team has released the latest version of Rails, version 2.3.2. Rails 2.3.2 comes after a few months following the Rails 2.2 release and offers many significant changes which should be of interest to all Rails developers.

This release seems to have the biggest number of major changes compared to any prior release. Please see the Rails 2.3 Release Notes for a complete list of updates. Installation is accomplish with:

gem install rails

The release notes indicate Rails 2.3.2:

Rails 2.3 should pass all of its own tests whether you are running on Ruby 1.8 or the now-released Ruby 1.9.1.

Application Architecture

Rack Support

Rails gets Rack support to have a standard API for web servers and web frameworks.

The underpinnings of script/server have been simplified and rewritten somewhat. The explicit list of supported servers that used to be in script/server is gone. Instead, Rails now depends on the installation of Rack, and script/server goes through this– which means that Rails supports any server that Rack does.

Rails Engines

Something which has not seen an upgrade in a while, allows for embedding a Rails application within another Rails application.

Rails Documentation

Although documentation isn’t normally considered a feature in a product release, this release of Rails is coupled with significant updates to all aspects of documentation available to Rails developers. Documentation is usually the last or weakest part of many open source project but the team has make major strides in producing really good documentation for developers.

It is important to note the many changes and updates to Rails documentation and communication coming from the core team and the newly created Rails Activists.

RDoc

  • Provides immediate help for syntax questions
  • Maintained by the actual core developers and generally up-to-date

Rails Guides

  • Provides focused “how to” help for particular problem domains http://guides.rubyonrails.org/
  • Target the mid-level developer, possibly with Rails experience
  • Have a large amount of existing high-quality material
  • Are already being continuously revised to track changes in edge Rails
  • Can include version-specific tutorial code samples
  • Can be delivered as a part of core Rails to provide “guidance at your fingertips” for new developers

Rails Book

  • Provides high-level architectural guidance and overview of how the pieces fit together
  • Digs into the philosophy of the “Rails Ways”, so readers can understand why the framework works the way it does
  • Targets the developer new to Rails or those wanting to go from the “trees” to the “forest” view
  • Offers help in conceptualizing Rails and choosing between alternative modules (ORMs, routing DSLs, etc.) in the Rails 3 timeframe
  • Can draw on the Merb experience in simultaneous translation and pulling in contributions from many writers
  • Largely version independent
  • Gives a structured path through end-to-end documentation in a way that standalone Guides do not

Rails Wiki

  • Community-driven documentation that can respond rapidly to new software and new questions
  • A good repository to links to external information
  • Potentially a showcase for Rails itself in the underlying software
  • A place to put the accumulated community knowledge, even the pieces that are not often needed

Active Record Updates

There are many Active Record updates in this release including the introduction of nested transactions.

  • Nested Attributes
  • Nested Transactions
  • Dynamic Scopes
  • Default Scopes
  • Batch Processing
  • Multiple Conditions for Callbacks
  • Find with having
  • Reconnecting MySQL Connections

Action Controller Changes

  • Unified Rendering
  • Application Controller Renamed
  • HTTP Digest Authentication Support
  • More Efficient Routing
  • Rack-based Lazy-loaded Sessions
  • MIME Type Handling Changes
  • Optimization of respond_to
  • Improved Caching Performance
  • Localized Views
  • Partial Scoping for Translations

Action View Changes

  • Nested Object Forms
  • Smart Rendering of Partials
  • Prompts for Date Select Helpers
  • AssetTag Timestamp Caching
  • Asset Hosts as Objects
  • grouped_options_for_select Helper Method
  • Disabled Option Tags for Form Select Helpers

Active Support Changes

Active Support has some nice changes, including the new Object#try.

  • Object#try
  • Object#tap Backport
  • Swappable Parsers for XMLmini
  • Fractional seconds for TimeWithZone
  • JSON Key Quoting

Railties

Some of the more interesting updates to Rails comes under this section.

  • Rails Metal

Rails Metal is a new mechanism that provides superfast endpoints inside of your Rails applications. Metal classes bypass routing and Action Controller to give you raw speed (at the cost of all the things in Action Controller, of course). This builds on all of the recent foundation work to make Rails a Rack application with an exposed middleware stack. Metal endpoints can be loaded from your application or from plugins.

More Information:

  • Application Templates

Rails 2.3 incorporates Jeremy McAnally’s rg application generator. What this means is that we now have template-based application generation built right into Rails; if you have a set of plugins you include in every application (among many other use cases), you can just set up a template once and use it over and over again when you run the rails command. There’s also a rake task to apply a template to an existing application:

rake rails:template LOCATION=~/template.rb

This will layer the changes from the template on top of whatever code the project already contains.

  • Quieter Backtraces
  • Faster Boot Time in Development Mode with Lazy Loading/Autoload
  • rake gem Task Rewrite

Please see the Rails 2.3 Release Notes for complete details on this release. There are a fair number of deprecations that should be reviewed to make upgrading applications a bit smoother.

Rate this Article

Adoption
Style

BT