Live: Microsoft Windows 10 hardware  

Technology Lab / Information Technology

Ruby on Rails 3.0 pulls into station with Merb in tow

A major release of the popular Web development framework is in the wild. Ars …




As a result, Merb developers who had begun as competitors of Rails were brought into the fold and helped Rails developers improve the project, leading to a better product and a much more harmonious Ruby universe.

What’s new?

Rails 3.0 boasts an improved version of Active Record—an object-relational mapper (ORM) which exposes a project’s data in code. The improved version incorporates iterative query building (building your query in a series of steps, instead of all at once) and delayed execution of the query, improving performance and efficiency in many cases.

The new version also sports an updated Action Controller—the framework’s URL routing engine. The new version fully and cleanly incorporates the idea of REST based resources which was hastily added to the 2.0 branch. Rails 3 is also now 100 percent Rack compatible. Rack support was added in 2.3, enabling Rails to be deployed on any Web server supporting the Rack interface. In 3.0, this is extended to the router which lets you run any Rack-compatible application within Rails—Sinatra, for example.

A controversial addition is the incorporation of a system called Bundler to manage project dependencies. Every project—Web or otherwise—builds on a curated library of libraries and plugins which add commonly used functionality. Bundler aims to solve this issue by helping developers build a package file (gem) that pulls in all of a project's requirements, generally for ease of deployment.

Bundler comes over from the Merb world with many detractors, but obviously fills a much-needed niche. Josh Peek, a developer at 37signals and a Rails core contributor, feels that Bundler is taking the wrong tack.

Dependencies come in many forms. Prepackaged libraries, called gems, are popular, but building dependencies directly out of source-controlled repositories—both public and private—is nearly equally so. Peek points out that those using Bundler have to employ tricks to utilize git repositories, forcing them to act like rubygems. To solve this, Peek is working on a similar project, called Rip, with Github cofounder Chris Wanstrath which he feels better serves developers by cleanly allowing anything to be used as a “package.” If you’re familiar with pip and virtualenv in the Python world, Rip hopes to be the Ruby equivalent.

Framework agnosticism is another big area of improvement brought over from Merb. Long ago, Rails was tied rather closely to a number of libraries like the Prototype JavaScript framework and its own ORM. Swapping in jQuery, an alternative data-mapper or testing framework is now supported and made simpler.

Additional updates include baked-in XSS protection, encoding fixes, Active Model clean-ups, official APIs for Rails components, and many internal rewrites.

Rails 3.0 (and a boatload of documentation) is available at this very moment. Check out the official post on the Ruby on Rails blog for code examples of the new features above, links to extra documentation, screencasts, books, and tutorials on getting started with Rails.

Expand full story

You must to comment.