The Ruby on Rails web application framework has built up a tremendous head of steam over the last year. Fueled by some significant benefits and an impressive portfolio of real-world applications already in production, Rails is destined to continue making significant inroads in 2006. Simply put, Ruby on Rails is an open source tool that gives you the advantage of rapidly creating great web applications backed by SQL databases to keep up with the speed of the web. And with the release of Rails 1.0 kicking off the new year, there’s never been a better time to climb aboard.
It should come as no surprise that Mac OS X is a favored platform for Rails development. Rails and its supporting cast of web servers and databases thrive on the rich Mac OS X environment. A popular text editor used by many Rails programmers is TextMate, a Cocoa application. And all members of the Rails core development team work with Macs.
This article introduces you to Ruby on Rails by building a trivial web application step by step. Consider it a ride on the express train—an overview of what Rails can do, including a look at features new to Rails 1.0. In the end you’ll be better equipped to consider the advantages of powering your web application with Rails.
Why Ruby on Rails?
First, you might be wondering: Web application frameworks are a dime a dozen, so what’s different about Rails? Here are a few things that make Ruby on Rails stand above the crowd:
* Full-Stack Web Framework. Rails is an MVC web framework where models, views, and controllers are fully integrated in a seamless fashion. That means you automatically get all the benefits of an MVC design without the hassle of explicitly configuring each component to play well with the others.
* Real-World Usage. The Rails framework was extracted from real-world web applications. That is, Rails comes from real need, not anticipating what might be needed. The result is an easy to use and cohesive framework that’s rich in functionality, and at the same time it does its best to stay out of your way.
* One Language: Ruby. Everything from business logic to configuration files (there aren’t many) are written in the Ruby programming language. With just one language, you hope it’s a good one, and Ruby doesn’t disappoint. Ruby is a full object-oriented language with clean syntax and it has a way of making programming truly fun. Using one language means you don’t have to juggle between multiple languages and dialects as you’re building your application.
* Convention over Configuration. Rails works hard to take care of all the repetitive and error-prone chores associated with starting to build a web application, and maintaining it over time. Rails uses simple naming conventions and clever use of reflection to make your work easier with near-zero configuration.
* It’s Productive! At the end of the day, Rails is all about helping you stay productive. And in a world where being the first to market and keeping customers happy adds up to increased revenues for you, it pays to pick a tool aligned with those goals. Many real-world applications are already reaping the benefits.
All that being said, the best way to judge Rails is to experience it while building an application. So let’s get right to it.
The version of Ruby that shipped on Mac OS X Tiger prior to v10.4.6 did not work well with Rails. If you’re running an earlier version of Tiger, you’ll need to either upgrade to 10.4.6 or upgrade your copy of Ruby to version 1.8.4 or later using the open source distribution.
And to do any serious Rails development you’ll want to install a production-quality web server, database server, and a few other goodies. Thankfully, a golden-path installation guide is already available.