Review: Build Your Own Ruby on Rails Web Applications
I was recently sent a copy of Patrick Lenz’s Build Your Own Ruby on Rails Web Applications, published by SitePoint. While I am certainly not in its target audience, I still found the book’s style refreshing, and even learned something about Rails I didn’t know before! (The
debug helper, for inspecting models in your views.)
The book is marketed as “the ultimate beginner’s guide to Ruby on Rails”, and while I don’t know that I would go quite that far, it is definitely a good introduction, especially if you are new to Ruby. I felt it spent about three or four chapters too many on introductory matter (you don’t really start doing anything with Rails itself until chapter 5) but once the book gets started it does a good job of helping you get a new Rails application off the ground.
- It was written for Rails 1.2, making it one of the few books available covering the newest version of the framework.
- It encourages unit and functional tests. Patrick mentions TDD, but does not follow it in the book, which is probably for the best in a book targeting people with little prior programming experience. Instead, each chapter ends with a section in which he walks through the process of adding tests for the features added in that chapter. Effective, but only as a step towards learning better testing practices.
- It makes good use of the code generators and migrations, demonstrating their strengths well.
- It shows how to implement a basic user authentication system without resorting to plugins! Far, far too many newcomers to Rails jump on the user-auth plugin bandwagon, which leads to cargo-culting. My advice is: never use a plugin you would not be able to write yourself. (Later in the book Patrick uses the acts_as_taggable plugin to implement tagging, but ultimately the point of the chapter was to show how to use plugins.)
- It walks you through setting up your first production environment. Although it doesn’t use Capistrano (which would be well beyond the scope of the book), it does mention Capistrano, as well as many other possible deployment environments (including SCGI, Mongrel, nginx, and more).
So, are you new to Ruby and Rails? Want to learn how to write dynamic web applications? This book will suit you nicely. However, if you have prior experience with building Rails apps, you’ll probably find this book too simple for your own needs.
Great work, Patrick! And congrats on getting a book based on Rails 1.2 out the door so quickly.