Home > Store

Merb Way, Rough Cuts, The

Rough Cuts

  • Available to Safari Subscribers
  • About Rough Cuts
  • Rough Cuts are manuscripts that are developed but not yet published, available through Safari. Rough Cuts provide you access to the very latest information on a given topic and offer you the opportunity to interact with the author to influence the final publication.

Not for Sale

Description

  • Copyright 2009
  • Dimensions: 7 X 9-1/8
  • Pages: 384
  • Edition: 1st
  • Rough Cuts
  • ISBN-10: 0-321-61905-6
  • ISBN-13: 978-0-321-61905-1

This is a working draft of a pre-release book. It is available before the published date as part of the Rough Cuts service.

“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

  • Master Merb innovations that will be incorporated into Rails 3
  • Understand the fundamentals of Merb development, one step at a time
  • Use Merb’s sophisticated application router to guide incoming requests
  • Explore the Merb stack, master its configuration options, and dive into its internals
  • Use Merb controllers to integrate application code, handle responses, and manage sessions, filters, and exceptions
  • Build templates with both ERB (Erubis) and HAML
  • Use the DataMapper ORM to represent object properties and behaviors
  • Learn best practices for RESTful development with Merb
  • Leverage Helpers to simplify many common development tasks
  • Refactor code, encapsulate it in gems, and share it across multiple applications
  • Customize the responses your application sends to each user
  • Gain a deep, practical understanding of Merb plugins and extensibility
  • Authenticate users with Merb’s modular authentication plugin
  • Configure, generate, describe, and test Merb mailers
  • Use the merb-parts gem to create component-like regions on Web pages
  • Cache content to relieve stress on Web servers
  • Make the most of Behavior Driven Development and testing with RSpec

Sample Content

Table of Contents

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

Updates

Submit Errata

More Information