Book Review: Beginning Rails
In: Reviews > Book Reviews
Published on August 20, 2007
As a card-carrying member of the web-standards blogosphere, I somehow feel a little odd holding a book that is not published by friends of ED or New Riders (and, what's more, doesn't have a foreword by either Andy Budd or Dave Shea)—but when one ventures into the world of back-end coding, one has to give up certain safety blankets and pick up more serious-looking books.
As a freelance web developer, I've long had Ruby on Rails on my list of ‘Things I really should get around to learning one day’—it has such a vocal and enthusiastic community, and powers so many of the sites and applications I use every day, it seemed inevitable that it would be added to the list of languages-with-confusingly-similar-syntax in my programming arsenal.
Who is the book for?
For most putative beginners, this will be not just an introduction to Rails, but also a first experience with an MVC (Model-View-Controller) framework; the book takes time to explain this important engineering pattern, and the authors do an excellent job of imbuing the reader with a sense of the philosophy behind Ruby on Rails. Coming to the book with a vague understanding of MVC through my experience with the PHP framework Code Igniter, I finished the chapter feeling much more confident in applying the various principles—Don't Repeat Yourself, convention over configuration—and a desire to keep my code (not just my Ruby) clean and pure.
What will I learn?
The book truly does start right at the very beginning, with a detailed installation walkthrough on all major platforms (Mac OS X, Windows, and Linux). I was disappointed that after the helpful Windows installation instructions, there wasn't a single mention of how to use Rails' built-in generators and helper tools on that platform (you have to specify the program to use on Windows, in case anyone else comes up against the same problem:
$ ruby script\generate controller Example).
For a Rails novice, what follows is a series of head-shaking, ‘That's cool!’ moments, as the book walks you through the basics of developing with Ruby on Rails; using the built-in web server, auto-generating files, finding your way around the interactive console, using the scaffolding feature (which allows you to create an entire database front-end with only one line of code), and creating and managing database migrations are all smoothly covered. The authors sensibly keep the explanations to a minimum in favor of allowing the reader to experiment and learn by doing. The authors wisely choose a familiar topic, and over the course of the 350-plus pages, the reader is guided through the construction of a functional events website (think Upcoming.org), which provides plenty of opportunity to demonstrate the key features of the Rails framework.
Two chapters are dedicated to the core of Rails' database interaction, Active Record, fairly early on in the book. Although it initially felt like it was too early to be wading through object-relational mapping, associations, and validation, in retrospect it is absolutely the right place to cover the topic, and indeed throughout the book, the structure is well thought-out and the information never overwhelms the novice reader.
While the book suffers from some unfortunate typos that would have hamstrung a true beginner, one hopes that these will have been corrected in subsequent editions. Overall, it does a great job of introducing not only the technical and theoretical concepts behind the successful framework, but also imparting much of the philosophy that has made Ruby on Rails such a hit with web authors.