1 Introduction

  1. What Makes a Good Recipe Book?
  2. What Makes This an Advanced Recipe Book?
  3. Who’s It For?
  4. Who’s Talking?
  5. Rails Version
  6. Resources
  7. Acknowledgments
  8. Tags and Thumb tabs

Part I—REST and Routes Recipes

  1. Putting A Resource On The Web 利用REST提供WebAPI
  2. Adding Your Own REST Actions (Or Not) 添加自定义的REST
  3. Authenticating REST Clients 制作REST的session登录
  4. Custom Response Formats 自定义反馈信息格式
  5. Catch All 404s 捕获404错误: 做好记录工作;充分利用DB的index以提高速度

Part II—Search Recipes

  1. Improve SEO with Dynamic Meta Tags 通过Meta标签提高搜索引擎收录
  2. Full-Text Search with Ferret 利用Ferret实现DB全文搜索
  3. Active Record on Solr 利用solr实现全文搜索

Part III—Database Recipes

  1. Adding Foreign Key Constraints 添加外键关联
  2. Write Your Own Custom Validations 添加自定义表单验证
  3. Analyzing SQL Queries 分析优化SQL搜索
  4. Taking Advantage of Master/Slave Databases 利用主从数据库实现读写

Part IV—User Interface Recipes

  1. Replacing In-View Raw JavaScript with RJS 利用嵌入式的RJS替代原生态JavaScript
  2. Handling Multiple Models In One Form 单个表单中提交多个Model
  3. Simplifying Controllers With a Presenter 对于一个controller里面的多model处理:可以采用视图/混合类的方式进行处理,原理同14.另外需要充分利用method_missing, 利用人为的方式规定表单数据域格式
  4. Validating Required Form Fields Inline 即时表单验证
  5. Creating a Wizard 制作步骤导航
  6. Updating # Partial Resources with Ajax 局部Ajax更新
  7. Uploading Images and Creating Thumbnails Ajax上传图片
  8. Decouple Your JavaScript with Low Pro 简化javascript

Part V—Design Recipes

  1. Freshening Up Your Models With Scope 利用with scope简化Model
  2. Keeping Forms Dry and Flexible 通过自定义的FormBuilder来DRY表单模板
  3. Prevent Train Wrecks with Delegate 利用委派机制将火车式的调用简单化
  4. Creating Meaningful Relationships Through Proxies 将Model间的关系语义化

Part VI—Asynchronous Recipes

  1. Processing an Asynchronous Workflow 处理异步工作流
  2. Off-Loading Long-Running Tasks to BackgrounDRb 将长时间任务处理放到后台

Part VII—E-mail Recipes

  1. Validating E-mail Addresses 验证Email格式
  2. Receiving E-mail Reliably via POP or IMAP 通过POP/IMAP收取邮件
  3. Keeping E-mail Addresses Up To Date 保证Email地址有效

Part VIII—Console Snacks

  1. Writin’ Console Methods 利用console
  2. Console Loggin’ Console日志
  3. Playin’ in the Sandbox 利用sandbox使console的操作最后对DB无效
  4. Accessin’ Helpers 利用Console查看helper效果
  5. Shortcuttin’ the Console console快捷键

Part IX—Testing

  1. Creating Your Own Rake Test Tasks 创建自己的Rake 测试任务
  2. Testing JavaScript With Selenium 利用selenium测试JS
  3. Mocking With a Safety Net 在安全的网络里测试
  4. Getting Started with BDD BDD
  5. Describing Behaviour from the Outside-In With RSpec RSpec描述行为
  6. Reducing Dependencies with Mocks 消除Mock中的依赖
  7. Fixtures Without Frustration 测试数据有效
  8. Tracking Test Coverage with RCov 利用RCov检测测试覆盖率
  9. Testing HTML Validity 检测HTML合法性

Part X—Performance and Scalability Recipes

  1. Looking Up Constant Data 制作常量数据
  2. Serving Page Caches to Facebook 制作缓存
  3. Profiling In The Browser 在Browser中检测性能
  4. Caching Up With the Big Guys 追踪性能问题根源
  5. Dynamically Updating Cached Pages 动态更新Cache

Part XI—Security Recipes

  1. Flipping On SSL 利用SSL
  2. Locking Down Sensitive Data 控制敏感数据

Part XII—Deployment and Capistrano Recipes

  1. Custom Maintenance Pages
  2. Running Multi-Stage Deployments
  3. Creating New Environments
  4. Managing Plugin Versions
  5. Safeguarding the Launch Codes
  6. Config Files On-The-Fly
  7. Preserving Files Between Deployments
  8. Responding To Remote Prompts
  9. Generating Custom Error Pages

Part XIII—Big-Picture Recipes

  1. Avoid Starting From Scratch
  2. Fail Early
  3. Analyzing Your Log Files
  4. Formatting Dates and Times
  5. Geocoding to Find Things By Location
  6. Giving Users Their Own Subdomain
  7. Tunneling Back to Your Application
  8. Monitoring (and Repairing) Processes with Monit

A Bibliography 288

Index 289