Introduction
It’s an exciting time for the Rails community. We have matured tremendously and our mainstream adoption
continues to pick up steam. Nearly 10 years after DHH first started playing with Ruby, it’s safe to say that
Rails remains a relevant and vital tool in the greater web technology ecosystem.
Rails 4 represents a big step forward for the community. We shed a variety of vestigial features that had
been deprecated in Rails 3. Security was beefed up and raw performance improved. Most everything in the
framework feels, well, tighter than before. Rails 4 is leaner and meaner than its previous incarnations, and so
is this edition of The Rails Way.
In addition to normal revisions to bring the text up to date with the evolution of Rails’ numerous APIs, this
edition adds a significant amount of new and updated material about Security, Performance and Caching,
Haml, RSpec, Ajax and the new Asset Pipeline.
About This Book
As with previous editions, this book is not a tutorial or basic introduction to Ruby or Rails. It is meant as a
day-to-day reference for the full-time Rails developer. The more confident reader might be able to get started
in Rails using just this book, extensive online resources, and his wits, but there are other publications that are
more introductory in nature and might be a wee bit more appropriate for beginners.
Every contributor to this book works with Rails on a full time basis. We do not spend our days writing books
or training other people, although that is certainly something that we enjoy doing on the side.
This book was originally conceived for myself, because I hate having to use online documentation, especially
API docs, which need to be consulted over and over again. Since the API documentation is liberally licensed
(just like the rest of Rails), there are a few sections of the book that reproduce parts of the API documentation.
In practically all cases, the API documentation has been expanded and/or corrected, supplemented with
additional examples and commentary drawn from practical experience.
Hopefully you are like me—I really like books that I can keep next to my keyboard, scribble notes in, and fill
with bookmarks and dog-ears. When I’m coding, I want to be able to quickly refer to both API documentation,
in-depth explanations, and relevant examples.
Book Structure
I attempted to give the material a natural structure while meeting the goal of being the best-possible Rails
reference book. To that end, careful attention has been given to presenting holistic explanations of each
subsystem of Rails, including detailed API information where appropriate. Every chapter is slightly different
in scope, and I suspect that Rails is now too big a topic to cover the whole thing in depth in just one book.
Believe me, it has not been easy coming up with a structure that makes perfect sense for everyone. Particularly,
I have noted surprise in some readers when they notice that Active Record is not covered first. Rails is foremost
a web framework and at least to me, the controller and routing implementation is the most unique, powerful,
and effective feature, with Active Record following a close second.