October 12, 2011

Hard to believe it’s been five years since the original, wildly popular Rails Recipes. Back in 2006, Pioneer 10 went silent, Pluto was demoted from planet status, and Rails was at Version 1.0.

A lot has changed since then, and while Pluto will always be a planet to us, Rails has moved on to 3.1, with a lot of deep changes along the way. Catch up now with Rails Recipes: Rails 3 Edition, now in beta at pragprog.com/book/rr2

Heads up: November will once again feature PragproWriMo. Time to start getting ready! More info in this month’s magazine.

Rails Recipes for Rails 3.1

Written for novice to intermediate Rails developers, Rails Recipes: Rails 3 Edition is packed with solutions to 70 of the most vexing problems you’re likely to face on the job.

From building custom forms and powering pages with JQuery to integrating with legacy databases, it’s all here. Each recipe has been updated to reflect the latest features of Rails 3.1 and each lays out a distinctive solution to a problem you may be facing today or could well encounter tomorrow.

In addition, you’ll find half the book is stocked with new eye-opening solutions to such common problems as how to extend Rails, test and deploy your sites, or add a web service to your actions. And each recipe not only lays out a succinct solution, but explains its rationale and the technologies that make it work.

Loaded with the insights of a Rails community leader, members of the Rails core team, and other experts, this is the book you’ll want to have at your side as you craft your next project.

Now available in beta from pragprog.com/book/rr2.

Current Table of Contents:

  • Database Recipes
    • Create Meaningful Many-to-Many Relationships
    • Create Declarative Named Queries
    • Connect to Multiple Databases
    • Set Default Criteria For Model Operations
    • Add Behavior to Active Record Associations
    • Create Polymorphic Associations
    • Version Your Models
    • Perform Calculations on Your Model Data
    • Use Active Record Outside of Rails
    • Connect to Legacy Databases
    • Make Dumb Data Smart with composed_of()
    • DRY Up Your YAML Database Configuration File
    • Use Models Safely in Migrations
    • Create Self-referential Many-to-Many Relationships
    • Protect Your Data From Accidental Mass-Update
    • Create a Custom Model Validator
    • Nest has_many :through Relationships
    • Keep Your Application In Synch With Your Database Schema
    • Seed Your Database with Starting Data
    • Use Helpers in Models
    • Avoid Dangling Database Dependencies
  • Controller Recipes
    • Create Nested Resources
    • Create a Custom Action in a REST Controller
    • Create a Helper Method to Use In Both Controllers And Views
    • Trim Your REST Resources
    • Constrain Routes by Subdomain (and Other Conditions)
    • Add Web Services to Your Actions
    • Write Macros
    • Manage a Static HTML Site with Rails
    • Syndicate Your Site with RSS
    • Set Your Application’s Home Page
  • User Interface Recipes
    • Create a Custom Form Builder
    • Pluralize Words on the Fly (or Not)
    • Insert Action-Specific Content in a Layout
    • Add Unobtrusive Ajax with jQuery
    • Create One Form for Many Models
    • Cache Local Data with HTML 5 Data Attributes
  • Testing Recipes
    • Automate Tests for Your Models
    • Test Your Controllers
    • Test Your Helpers
    • Test Your Outgoing Mailers
    • Testing Across Multiple Controllers
    • Focus Your Tests with Mocking
    • Extracting Test Fixtures from Live Data
    • Creating Dynamic Test Fixtures
    • Measure and Improve Your Test Coverage
    • Creating Test Data With Factories
  • Email Recipes
    • Send Gracefully Degrading Rich-Content Emails
    • Sending Email with Attachments
    • Test Incoming Email
  • Big-Picture Recipes
    • Roll Your Own Simple Authentication
    • Protect Your Application with Basic HTTP Authentication
    • Authorizing Users with Roles
    • Force Your Users to Access Actions via SSL
    • Secret URLs
    • Rails without a Database
    • Creating Your Own Ruby Gem
    • Using Bundler Groups to Manage per-Environment Dependencies
    • Write a Gem Which Contains Rake Tasks
    • Use the Rails Console
    • Create Your Own Rake Tasks
    • Generate Documentation for Your Application
    • Rendering Comma-Separated Values from Your Actions
    • Generate and Serve PDFs
  • Extending Rails
    • Create a Custom Renderer
    • Write a Custom Parameter Parser
    • Templatize Your Generated Rails Applications
    • Create a Custom Generator
    • Create a Mountable Application as a Rails Engine Plug-In

Don’t Get Left Out

Are your friends jealous that you get these spiffy email newsletters and they don’t? Clue them in that all they need to do is create an account on pragprog.com (email address and password is all it takes) and select the checkbox to receive newsletters.

Are you following us on Twitter and/or FaceBook? Here’s where you can find us and keep up with the latest news and commentary:

Coming Soon:

  • Programming Your Home
  • Create Awesome Command-Line Applications in Ruby
  • The Developer’s Code
  • Programming Node.js
  • ...and a few surprises.

Recently Released:

  • Cutting an Agile Groove [video]
  • Technical Blogging [in beta]
  • Programming Clojure, 2nd Ed [in beta]
  • Programming Concurrency on the JVM [in print]
  • Thanks for your continued support,

    Dave & Andy

    Books • eBooks • Screencasts • PragPub Magazine
    PragProg.com