HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
The Rails™ 3 Way is a comprehensive resource that digs into the new features in Rails 3 and perhaps more importantly, the rationale behind them.
—Yehuda Katz, Rails Core
The Bible for Ruby on Rails Application Development
Ruby on Rails strips complexity from the development process, enabling professional developers to focus on what matters most: delivering business value via clean and maintainable code. The Rails™ 3 Way is the only comprehensive, authoritative guide to delivering production-quality code with Rails 3. Pioneering Rails expert Obie Fernandez and a team of leading experts illuminate the entire Rails 3 API, along with the idioms, design approaches, and libraries that make developing applications with Rails so powerful. Drawing on their unsurpassed experience and track record, they address the real challenges development teams face, showing how to use Rails 3 to maximize your productivity.
Using numerous detailed code examples, the author systematically covers Rails 3 key capabilities and subsystems, making this book a reference that you will turn to again and again. He presents advanced Rails programming techniques that have been proven effective in day-to-day usage on dozens of production Rails systems and offers important insights into behavior-driven development and production considerations such as scalability. Dive deep into the Rails 3 codebase and discover why Rails is designed the way it is—and how to make it do what you want it to do.
This book will help you
"The Best Programming Advice I Ever Got" with Obie Fernandez
An Interview with Obie Fernandez on Rails 3
Download the sample pages (includes Chapter 9 and Index)
Foreword by David Heinemeier Hansson xxxiii
Foreword by Yehuda Katz xxxv
Introduction xxxvii
Acknowledgments xliii
About the Author xlv
Chapter 1: Rails Environments and Configuration 1
1.1 Bundler 2
1.2 Startup and Application Settings 8
1.3 Development Mode 15
1.4 Test Mode 19
1.5 Production Mode 20
1.6 Logging 23
1.7 Conclusion 29
Chapter 2: Routing 31
2.1 The Two Purposes of Routing 32
2.2 The routes.rb File 33
2.3 Route Globbing 45
2.4 Named Routes 46
2.5 Scoping Routing Rules 50
2.6 Listing Routes 53
2.7 Conclusion 54
Chapter 3: REST, Resources, and Rails 55
3.1 REST in a Rather Small Nutshell 55
3.2 Resources and Representations 56
3.3 REST in Rails 57
3.4 Routing and CRUD 58
3.5 The Standard RESTful Controller Actions 61
3.6 Singular Resource Routes 64
3.7 Nested Resources 65
3.8 RESTful Route Customizations 69
3.9 Controller-Only Resources 74
3.10 Different Representations of Resources 76
3.11 The RESTful Rails Action Set 78
3.12 Conclusion 83
Chapter 4: Working with Controllers 85
4.1 Rack 86
4.2 Action Dispatch: Where It All Begins 88
4.3 Render unto View 92
4.4 Additional Layout Options 101
4.5 Redirecting 101
4.6 Controller/View Communication 104
4.7 Filters 105
4.8 Verification 111
4.9 Streaming 112
4.10 Conclusion 117
Chapter 5: Working with Active Record 119
5.1 The Basics 120
5.2 Macro-Style Methods 121
5.3 Defining