Rails Cookbook (Cookbooks Series)


Rails Cookbook is packed with the solutions you need to be a proficient developer with Rails, the leading framework for building the new generation of Web 2.0 applications. Recipes range from the basics, like installing Rails and setting up your development environment, to the latest techniques, such as developing RESTful web services.

With applications that are code light, feature-full and built to scale quickly, Rails has revolutionized web development. The Rails Cookbook ...

See more details below
Other sellers (Paperback)
  • All (34) from $1.99   
  • New (10) from $4.03   
  • Used (24) from $1.99   
Rails Cookbook

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
BN.com price
(Save 43%)$31.99 List Price


Rails Cookbook is packed with the solutions you need to be a proficient developer with Rails, the leading framework for building the new generation of Web 2.0 applications. Recipes range from the basics, like installing Rails and setting up your development environment, to the latest techniques, such as developing RESTful web services.

With applications that are code light, feature-full and built to scale quickly, Rails has revolutionized web development. The Rails Cookbook addresses scores of real-world challenges; each one includes a tested solution, plus a discussion of how and why it works, so that you can adapt the techniques to similar situations. Topics include:

  • Modeling data with the ActiveRecord library
  • Setting up views with ActionView and RHTML templates
  • Building your application's logic into ActionController
  • Testing and debugging your Rails application
  • Building responsive web applications using JavaScript and Ajax
  • Ensuring that your application is security and performs well
  • Deploying your application with Mongrel and Apache
  • Using Capistrano to automate deployment
  • Using the many Rails plugins
  • Working with graphics

Whether you're new to Rails or an experienced developer, you'll discover ways to test, debug and secure your applications, incorporate Ajax, use caching to improve performance, and put your application into production. Want to get ahead of the Web 2.0 curve? This valuable cookbook will save you hundreds of hours when developing applications with Rails.

Rails is one of the leading frameworks for developing the new generation of Web 2.0 applications using the increasingly popular Ruby scripting language. This title is for all web developers, regardless of experience, who want to learn about the fastest growing web application framework on the market.

Read More Show Less

Product Details

  • ISBN-13: 9780596527310
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 12/28/2006
  • Series: Cookbooks (O'Reilly) Series
  • Edition number: 1
  • Pages: 544
  • Product dimensions: 7.00 (w) x 9.19 (h) x 0.97 (d)

Meet the Author

Rob Orsini is the author of the Rails Cookbook (O'Reilly). He's also the founder and CEO of Tuple Shop, Inc., a web software consulting company specializing in Rails and Python development. Previously, Rob was webmaster at Industrial Light & Magic (a Lucasfilm company), and software engineer at O'Reilly Media. Rob has been programming the web since the late nineties, and enjoys the leading edge of development with dynamic languages such as Ruby and Python. Additionally, Rob is a jazz musician, a builder, and a loving husband and father.

Read More Show Less

Table of Contents

Who This Book Is For;
Other Resources;
Conventions Used in This Book;
Using Code Examples;
Safari® Enabled;
Comments and Questions;
Chapter 1: Getting Started;
1.1 Introduction;
1.2 Joining the Rails Community;
1.3 Finding Documentation;
1.4 Installing MySQL;
1.5 Installing PostgreSQL;
1.6 Installing Rails;
1.7 Fixing Ruby and Installing Rails on OS X 10.4 Tiger;
1.8 Running Rails in OS X with Locomotive;
1.9 Running Rails in Windows with Instant Rails;
1.10 Updating Rails with RubyGems;
1.11 Getting Your Rails Project into Subversion;
Chapter 2: Rails Development;
2.1 Introduction;
2.2 Creating a Rails Project;
2.3 Jump-Starting Development with Scaffolding;
2.4 Speeding Up Rails Development with Mongrel;
2.5 Enhancing Windows Development with Cygwin;
2.6 Understanding Pluralization Patterns in Rails;
2.7 Developing Rails in OS X with TextMate;
2.8 Cross-Platform Developing with RadRails;
2.9 Installing and Running Edge Rails;
2.10 Setting Up Passwordless Authentication with SSH;
2.11 Generating RDoc for Your Rails Application;
2.12 Creating Full-Featured CRUD Applications with Streamlined;
Chapter 3: Active Record;
3.1 Introduction;
3.2 Setting Up a Relational Database to Use with Rails;
3.3 Programmatically Defining Database Schema;
3.4 Developing Your Database with Migrations;
3.5 Modeling a Database with Active Record;
3.6 Inspecting Model Relationships from the Rails Console;
3.7 Accessing Your Data via Active Record;
3.8 Retrieving Records with find;
3.9 Iterating Over an Active Record Result Set;
3.10 Retrieving Data Efficiently with Eager Loading;
3.11 Updating an Active Record Object;
3.12 Enforcing Data Integrity with Active Record Validations;
3.13 Executing Custom Queries with find_by_sql;
3.14 Protecting Against Race Conditions with Transactions;
3.15 Adding Sort Capabilities to a Model with acts_as_list;
3.16 Performing a Task Whenever a Model Object Is Created;
3.17 Modeling a Threaded Forum with acts_as_nested_set;
3.18 Creating a Directory of Nested Topics with acts_as_tree;
3.19 Avoiding Race Conditions with Optimistic Locking;
3.20 Handling Tables with Legacy Naming Conventions;
3.21 Automating Record Timestamping;
3.22 Factoring Out Common Relationships with Polymorphic Associations;
3.23 Mixing Join Models and Polymorphism for Flexible Data Modeling;
Chapter 4: Action Controller;
4.1 Introduction;
4.2 Accessing Form Data from a Controller;
4.3 Changing an Application’s Default Page;
4.4 Clarifying Your Code with Named Routes;
4.5 Configuring Customized Routing Behavior;
4.6 Displaying Alert Messages with Flash;
4.7 Extending the Life of a Flash Message;
4.8 Following Actions with Redirects;
4.9 Generating URLs Dynamically;
4.10 Inspecting Requests with Filters;
4.11 Logging with Filters;
4.12 Rendering Actions;
4.13 Restricting Access to Controller Methods;
4.14 Sending Files or Data Streams to the Browser;
4.15 Storing Session Information in a Database;
4.16 Tracking Information with Sessions;
4.17 Using Filters for Authentication;
Chapter 5: Action View;
5.1 Introduction;
5.2 Simplifying Templates with View Helpers;
5.3 Displaying Large Datasets with Pagination;
5.4 Creating a Sticky Select List;
5.5 Editing Many-to-Many Relationships with Multiselect Lists;
5.6 Factoring Out Common Display Code with Layouts;
5.7 Defining a Default Application Layout;
5.8 Generating XML with Builder Templates;
5.9 Generating RSS Feeds from Active Record Data;
5.10 Reusing Page Elements with Partials;
5.11 Processing Dynamically Created Input Fields;
5.12 Customizing the Behavior of Standard Helpers;
5.13 Creating a Web Form with Form Helpers;
5.14 Formatting Dates, Times, and Currencies;
5.15 Personalizing User Profiles with Gravatars;
5.16 Avoiding Harmful Code in Views with Liquid Templates;
5.17 Globalizing Your Rails Application;
Chapter 6: RESTful Development;
6.1 Introduction;
6.2 Creating Nested Resources;
6.3 Supporting Alternative Data Formats by MIME Type;
6.4 Modeling Relationships RESTfully with Join Models;
6.5 Moving Beyond Simple CRUD with RESTful Resources;
6.6 Consuming Complex Nested REST Resources;
6.7 Developing Your Rails Applications RESTfully;
Chapter 7: Rails Application Testing;
7.1 Introduction;
7.2 Centralizing the Creation of Objects Common to Test Cases;
7.3 Creating Fixtures for Many-to-Many Associations;
7.4 Importing Test Data with CSV Fixtures;
7.5 Including Dynamic Data in Fixtures with ERb;
7.6 Initializing a Test Database;
7.7 Interactively Testing Controllers from the Rails Console;
7.8 Interpreting the Output of Test::Unit;
7.9 Loading Test Data with YAML Fixtures;
7.10 Monitoring Test Coverage with rake stats;
7.11 Running Tests with Rake;
7.12 Speeding Up Tests with Transactional Fixtures;
7.13 Testing Across Controllers with Integration Tests;
7.14 Testing Controllers with Functional Tests;
7.15 Examining the Contents of Cookie;
7.16 Testing Custom and Named Routes;
7.17 Testing HTTP Requests with Response-Related Assertions;
7.18 Testing a Model with Unit Tests;
7.19 Unit Testing Model Validations;
7.20 Verifying DOM Structure with Tag-Related Assertions;
7.21 Writing Custom Assertions;
7.22 Testing File Upload;
7.23 Modifying the Default Behavior of a Class for Testing by Using Mocks;
7.24 Improving Feedback by Running Tests Continuously;
7.25 Analyzing Code Coverage with Rcov;
Chapter 8: JavaScript and Ajax;
8.1 Introduction;
8.2 Adding DOM Elements to a Page;
8.3 Creating a Custom Report with Drag and Drop;
8.4 Dynamically Adding Items to a Select List;
8.5 Monitoring the Content Length of a Textarea;
8.6 Updating Page Elements with RJS Templates;
8.7 Inserting JavaScript into Templates;
8.8 Letting a User Reorder a List;
8.9 Autocompleting a Text Field;
8.10 Searching for and Highlighting Text Dynamically;
8.11 Enhancing the User Interface with Visual Effects;
8.12 Implementing a Live Search;
8.13 Editing Fields in Place;
8.14 Creating an Ajax Progress Indicator;
Chapter 9: Action Mailer;
9.1 Introduction;
9.2 Configuring Rails to Send Email;
9.3 Creating a Custom Mailer Class with the Mailer Generator;
9.4 Formatting Email Messages Using Templates;
9.5 Attaching Files to Email Messages;
9.6 Sending Email from a Rails Application;
9.7 Receiving Email with Action Mailer;
Chapter 10: Debugging Rails Applications;
10.1 Introduction;
10.2 Exploring Rails from the Console;
10.3 Fixing Bugs at the Source with Ruby -cw;
10.4 Debugging Your Application in Real Time with the breakpointer;
10.5 Logging with the Built-in Rails Logger Class;
10.6 Writing Debugging Information to a File;
10.7 Emailing Application Exceptions;
10.8 Outputting Environment Information in Views;
10.9 Displaying Object Contents with Exceptions;
10.10 Filtering Development Logs in Real Time;
10.11 Debugging HTTP Communication with Firefox Extensions;
10.12 Debugging Your JavaScript in Real Time with the JavaScript Shell;
10.13 Debugging Your Code Interactively with ruby-debug;
Chapter 11: Security;
11.1 Introduction;
11.2 Hardening Your Systems with Strong Passwords;
11.3 Protecting Queries from SQL Injection;
11.4 Guarding Against Cross-Site Scripting Attacks;
11.5 Restricting Access to Public Methods or Actions;
11.6 Securing Your Server by Closing Unnecessary Ports;
Chapter 12: Performance;
12.1 Introduction;
12.2 Measuring Web Server Performance with Httperf;
12.3 Benchmarking Portions of Your Application Code;
12.4 Improving Performance by Caching Static Pages;
12.5 Expiring Cached Pages;
12.6 Mixing Static and Dynamic Content with Fragment Caching;
12.7 Filtering Cached Pages with Action Caching;
12.8 Speeding Up Data Access Times with memcached;
12.9 Increasing Performance by Caching Post-Processed Content;
Chapter 13: Hosting and Deployment;
13.1 Introduction;
13.2 Hosting Rails Using Apache 1.3 and mod_fastcgi;
13.3 Managing Multiple Mongrel Processes with mongrel_cluster;
13.4 Hosting Rails with Apache 2.2, mod_proxy_balancer, and Mongrel;
13.5 Deploying Rails with Pound in Front of Mongrel, Lighttpd, and Apache;
13.6 Customizing Pound’s Logging with cronolog;
13.7 Configuring Pound with SSL Support;
13.8 Simple Load Balancing with Pen;
13.9 Deploying Your Rails Project with Capistrano;
13.10 Deploying Your Application to Multiple Environments with Capistrano;
13.11 Deploying with Capistrano When You Can’t Access Subversion;
13.12 Deploying with Capistrano and mongrel_cluster;
13.13 Disabling Your Web Site During Maintenance;
13.14 Writing Custom Capistrano Tasks;
13.15 Cleaning Up Residual Session Records;
Chapter 14: Extending Rails with Plug-ins;
14.1 Introduction;
14.2 Finding Third-Party Plug-ins;
14.3 Installing Plug-ins;
14.4 Manipulating Record Versions with acts_as_versioned;
14.5 Building Authentication with acts_as_authenticated;
14.6 Simplifying Folksonomy with the acts_as_taggable;
14.7 Extending Active Record with acts_as;
14.8 Adding View Helpers to Rails as Plug-ins;
14.9 Uploading Files with file_column;
14.10 Uploading Files with acts_as_attachment;
14.11 Disabling Records Instead of Deleting Them with acts_as_paranoid;
14.12 Adding More Elaborate Authentication Using the Login Engine;
Chapter 15: Graphics;
15.1 Introduction;
15.2 Installing RMagick for Image Processing;
15.3 Uploading Images to a Database;
15.4 Serving Images Directly from a Database;
15.5 Creating Resized Thumbnails with RMagick;
15.6 Generating PDF Documents;
15.7 Visually Displaying Data with Gruff;
15.8 Creating Small, Informative Graphs with Sparklines;
Migrating to Rails 1.2;
Action Controller;
Active Record;
Action View;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)