B.1 Top-LevelCon.guration ...................... 644
B.2 ActiveRecordCon.guration .................... 646
B.3 ActionControllerCon.guration . . . . . . . . . . . . . . . . . . 648
B.4 ActionViewCon.guration ..................... 649
B.5 ActionMailerCon.guration .................... 650
B.6 TestCaseCon.guration ...................... 651
Report erratum
Prepared exclusively for Jordan A. Fowler
CONTENTS
C Source Code
C.1 TheFullDepotApplication ..................... 652
D Resources 683
D.1 OnlineResources .......................... 683
D.2 Bibliography ............................. 683
Index 684
Report erratum
Prepared exclusively for Jordan A. Fowler
Touslesjours,a touslespointsdevue,je vaisdemieuxen mieux.
EmileCoue
PrefacetotheSecondEdition
It has been 18 months since I announced the .rst edition of this book. It was clear before the book came out that Rails would be big, but I don�ft think anyoneback then realizedjusthow signi.cant thisframework would turn out tobe.
In the year that followed, Rails went from strength to strength. It was used as the basis for any number of new, exciting web sites. Just as signi.cantly, large corporations(many ofthemhousehold names) startedto useRailsfor both inward-and outward-facing applications. Rails gained critical acclaim, too.DavidHeinemeierHansson, the creator ofRails, was named Hacker of the Year atOSCON.Rails won aJoltAward asbest webdevelopmenttool, and the .rst edition of thisbook received aJoltAward asbest technicalbook.
But the Rails core team didn�ft just sit still, soaking up the praise. Instead, they�fve been heads-down adding new features and facilities. Rails 1.0, which came out some months after the .rst edition hit the streets, added features such as database migration support, as well as updated AJAX integration. Rails 1.1, released in the spring of 2006, was a blockbuster, with more than 500 changes since the previous release. Many of these changes are deeply signi.cant.For example,RJS templateschangethe way thatdeveloperswrite AJAX-enabledapplications, andtheintegrationtestingframeworkchangesthe waythese applications canbetested.Alot of workhasgoneinto extending and enhancingActiveRecord, which nowincludespolymorphic associations,join models,better caching, and a wholelot more.
The time had come to update the book to re.ect all this goodness. And, as I started makingthe changes,I realizedthat something elsehad changed.Inthe time since the .rst book was released, we�fd all gained a lot more experience ofjust how to write a Rails application. Some stuff that seemed like a great idea didn�ft work so well in practice, and other features that initially seemed peripheral turned out to be signi.cant. And those new practices meant that the changes to the book went far deeper than I�fd expected. I was no longer doinga cosmetic sweepthroughthetext, adding a couple of newAPIs.Instead, I found myself rewriting the content. Some chapters from the original have been removed, andnew chaptershavebeen added.Many of the resthavebeen
Prepared exclusively for Jordan A. Fowler
PREFACE TO THE SECOND EDITION
completely rewritten. So, it became clear that we were looking at a second edition.basically a newbook.
Agile Web Development with Rails
Start from the beginning
