SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
“Foy is a gifted writer and his descriptions of the philosophies that( impacted the design and implementation of Merb are definitely useful to( everyone affected by the changes in Rails 3.”
–Obie Fernandez, Series Editor
The Expert Guide to Building Merb Applications
Thousands of Ruby and Rails developers are discovering the extraordinary scalability, agility, flexibility, and performance offered by the new Merb MVC framework. The Merb Way is the first comprehensive guide to using, extending, and deploying Merb. Like the bestseller The Rails Way (Addison-Wesley, 2008), this book can either be read cover-to-cover as a tutorial or used for modular coverage that makes it an ideal task reference. Foy Savas systematically covers everything developers need to know to build production-quality Merb applications, offering detailed code examples for jumpstarting virtually any project.
Savas is not only involved in the Merb project as an open source contributor: He uses Merb every day as a professional developer. Drawing on his extensive practical expertise, he delves deeply into the Merb framework’s architecture and source code, revealing its elegance and offering powerful best practices for using it. To maximize this book’s practical value, he also covers the tools most widely used alongside Merb, including the DataMapper ORM, the RSpec tester (and associated behavior-driven development techniques), and several leading Merb plugins.
The Merb Way will help you
Foreword xix
Acknowledgments xxi
Merb pastie xxiii
Introduction xxvii
About the author xxxi
Chapter 1: Fundamentals 1
1.1 Generating a new application 1
1.2 The layout of a Merb application 2
1.3 Interactive Merb 9
1.4 Merb configuration 12
1.5 Understanding the Merb stack 20
1.6 An overview of Merb internals 27
1.7 Conclusion 35
Chapter 2: Routing 37
2.1 How Merb routing works 38
2.2 Router configuration 43
2.3 Checking routes 45
2.4 Match rules 50
2.5 Registering routes 54
2.6 Other route settings 57
2.7 Resource routes 60
2.8 Conclusion 64
Chapter 3: Controllers 65
3.1 From request to controller 65
3.2 The controller classes 68
3.3 Custom controller classes 75
3.4 Filters 79
3.5 Redirects 84
3.6 Exceptions 87
3.7 Rendering templates 89
3.8 run_later 97
3.9 Sending and streaming 97
3.10 Conclusion 99
Chapter 4: Views 101
4.1 ERB 101
4.2 Haml 105
4.3 Merb view templates 109
4.4 Partials 111
4.5 Conclusion 112
Chapter 5: Models 113
5.1 Configuration 113
5.2 Model classes 115
5.3 Properties 118
5.4 Associations 132
5.5 CRUD basics 140
5.6 Hooks 154
5.7 Plugins 155
5.8 Conclusion 165
Chapter 6: Helpers 167
6.1 Truncate helper 167
6.2 Numeric helpers 168
6.3 Date and time helpers 171
6.4 Cycle helper 176
6.5 Tag helpers 177
6.6 Form helpers 179
6.7 Conclusion 192
Chapter 7: Slices 193
7.1 Slice development 193
7.2 Slice usage 201
7.3 Conclusion 203
Chapter 8: Sessions 205
8.1 How sessions work 205
8.2 Configuration 206
8.3 Storing sessions 207
8.4 Request access 219
8.5 Controller access 220
8.6 Conclusion 220
Chapter 9: Authentication 221
9.1 Auth core 221
9.2 Auth more 237
9.3 Auth password slices 245
9.4 Conclusion 251
Chapter 10: Mailers 253
10.1 Configuration 253
10.2 Using mailers directly 255
10.3 Mail controllers 257
10.4 Testing 261
10.5 Generation 261
10.6 Conclusion 262
Chapter 11: Parts 263
11.1 Parts controllers 263
11.2 Invoking actions 266
11.3 Generation 267
11.4 Conclusion 267
Chapter 12: Caching 269
12.1 Configuration 269
12.2 Caching basics 271
12.3 Caching helpers 274
12.4 Conclusion 278
Chapter 13: Testing 279
13.1 Rake tasks 279
13.2 Spec files 282
13.3 Model specs 283
13.4 Request specs 285
13.5 Request helper 289
13.6 Request matchers 290
13.7 RSpec extensions 292
13.8 Miscellaneous extensions 294
13.9 Conclusion 295
Afterword 297
Index 299