Ruby on Rails: What It Can Do for You

What is Ruby on Rails?

Ruby on Rails, released in 2004, is an increasingly popular open-source framework for Web applications. It aims to be a “full-stack” framework, meaning that it tries to address all aspects of the Web development process. In contrast, open-source developers working in Java often find themselves piecing together several technologies to address different layers of their Web architecture, such as Struts for the user interface and Hibernate to automate the storage and retrieval of database content.

Obie Fernandez, a consultant and author of the book The Rails Way, says Rails gives open-source developers something a little closer to the Microsoft .NET environment, “where you can just start working because everything is designed to work together.”

How does Ruby on Rails work?

Besides striving to be all-encompassing, Rails promotes a common set of assumptions about how a Web application should be designed, right down to the conventions for naming objects, database tables, files and directories. For example, by default the data associated with a software object called “person” will be stored in a table called “people,” according to a built-in association between singular objects and plural rows in a database table.

Developers typically start by running a Ruby script that automatically generates a “scaffolding” of files and directories, according to a standard naming scheme associated with common data manipulation routines—create, read, update and delete. By following these conventions, unless they have a very good reason not to, Rails developers say they avoid a lot of configuration headaches normally associated with telling an application where to look for files, database content and other resources. That’s what Rails creator David Heinemeier Hansson refers to as “convention over configuration.”

What are some advantages of Ruby on Rails?

Rails’ scaffolding represents the default structure for an application, which promotes rapid application development. If, for example, you’re creating an expense report application, the generated code could include basic Web page templates for the forms to create, list and view reports, along with the software that connects them to a database table. This eliminates some of the preliminaries of setting up a development environment and allows programmers to concentrate on adding more sophisticated functionality.

The user interface of Ruby on Rails has strong support for Ajax (Asynchronous JavaScript and XML), a technique used in applications like Google Maps to invoke functions on a server and change what is displayed on a Web page without reloading the entire page.

What’s the catch involving Ruby on Rails?

Ruby on Rails is still relatively new. The programming language it’s based on, Ruby, goes back to the mid-1990s, but many developers will be encountering it for the first time. So far, Rails support is strongest for the Linux operating system and open-source databases such as MySQL and Postgres, as opposed to commercial databases like Oracle. Rails may also be better for the development of a completely new application, for which the accompanying database will be created from scratch.

Even for Web developers, learning to trust the framework can be a challenge. “I found myself fighting the framework a lot when I first got started with it,” says Richard Cavanaugh, chief technology officer of Todobebe, a Spanish-language Web site that sells maternity and baby products. “Eventually, I decided I’d try to do it the Rails way and see how that worked—and it worked really well.”

In addition, I.T. operations staffers may resist supporting Ruby on Rails because it’s not part of their accepted software infrastructure. Rails fans are hoping it will win more acceptance with JRuby, an open-source effort to allow Ruby to run on Java servers and integrate with existing Java software.

Ruby on Rails, though, has found its way into some large enterprises. Fernandez worked on a Rails project at John Deere, andhe knows of efforts at financial institutions such as Bear Stearns.