My first review of the Agile Web Development with Rails review covered the first half of the book which takes a tutorial approach to build a web shop. This review will cover the second part of the book called “Rails in Depth”. These 280 pages examine the various components of Rails like ActiveRecord or ActionController in detail. Further security issues and scaling are covered as well. Note that this review is based on the first beta of the book.
Chapter 13 gives an overview of the Rails environment and configuration. It explains the responsibility of each component and touches debugging and logging.
Chapter 14 and 15 are devoted to ActiveRecord, the Object-Relational Mapper used by Rails. From teaching rails how to access the database, how to create, read, update, and delete records (CRUD) to the built-in functions like find and count, every basic aspect of ActiveRecord is covered. After the teaching the basics, more advanced topics like locking and the various relationships between objects (has_may, belongs_to,...) are explained. Also more exotic relations like acts_as_tree and inheritance are shown and explained very clearly. Chapter 15 ends with a detailed description of validations, call-backs and observers.
Chapter 16 (ActionController) describes routes, url creation, rendering and choosing of the templates, cookies and sessions, before explaining filters and verification. It ends with examining caching (page caching and action caching, fragment caching is part of chapter 17).
Templates are discussed in chapter 17 with a focus on RTHML templates (as opposed to builder XML templates). Also helpers and pagination, components, layouts and partials are covered.
Chapter 18 is one of my favorites. It’s called “The Web, 2.0” and describes how to use the various AJAX enabled helpers and how to use fancy built-in JavaScript effects to notify the user that something changes behind the scenes. This is one of the places where you can really feel how powerful and easy Rails is.
Chapter 19 is a short review of the capabilities of ActionMail with which you can send and receive emails in you Rails applications.
ActionWebService is discussed in chapter 20. You are shown how to transform normal actions into WebServices and how to defines the APIs. The three dispatching modes are examined briefly before the chapter ends with a guide on how to test WebServices.
After discussing the components of Rails, more general topics are focused on. Chapter 21 shows how to protect your Rails application from SQLInjection and Cross Site Scripting. Further it teaches some basic web application security like “do not execute uploaded files” or “do not cache authenticated pages”.
The last chapter addresses deployment and scaling. It provides an overview of deployment on WEBrick, Apache and lighttpd with example configuration. FastCGI and some advices on log files, error handling and sessions are described. Performance and how to identify bottlenecks conclude the chapter.
The book features three appendices. The first is a short (15 pages) introduction to Ruby in order to get the basics of Rails. Certainly enough for somebody who knows another OO-programming language. Appendix B lists all configuration options and Appendix C the source code used in the book.
My conclusion of this book is a very positive one. The first part shows you the power of Rails by building a small shop application in minutes and the second part explains all the details and hooks of Rails. Therefore this book is suited for everyone. The beginner starts with the tutorial while the expert can use the second part to enforce his knowledge.
If I hadn’t already bought it, I would buy it again!

