Rails 3 in a Nutshell

Cody Fauser

James MacAulay

Edward Ocampo-Gooding

John Guenin

This work has been released under the Creative Commons Attribution-Noncommercial license.

Abstract

Note

You are reading the text of an O'Reilly book that's under development. The authors are publishing the book to this site as it's being written, and we're putting it here to get feedback from you. This book uses the Open Feedback Publishing System (OFPS), an O'Reilly experiment that tries to bridge the gap between private manuscripts and public blogs.

Next to every paragraph, there is a link you can use to comment on what you're reading. We are grateful for any feedback you have: questions, comments, suggestions, and corrections are all welcome and appreciated.

8 comments

  1. Mike Summers Posted 9 months, 10 days and 13 hours ago

    Will there be an Action View Chapter? A placeholder would be good.

  2. Cody Fauser Posted 9 months, 10 days and 12 hours ago

    Mike,

    There will be. The incomplete sections are currently not shown, but you're right, it would be good to have the table of contents complete with the entire structure. However, that might also make it frustrating if most parts are empty.

  3. Justin Blake Posted 9 months, 4 days and 9 hours ago

    I think a complete table of contents would help so we're not worried something important might not be covered.

  4. Baumgertner Alex Posted 9 months, 3 days and 13 hours ago

    Hi. We would like to translate this book to russian lang, have we rights to do this? We start at http://railstranslate.novarchiv.org, but Wiki is not usable to do this :). Can you recommend any service for open-translate?

    PS: Thanks for this book :)

  5. Baumgertner Alex Posted 9 months, 3 days and 12 hours ago

    We are http://translated.by/you/rails-in-a-nutshell/ :)

  6. Faisal N Jawdat Posted 8 months, 8 days and 14 hours ago

    Can we get a one-page version of the book (including comments) so we can load it into our Kindles or what have you?

  7. Zaid Zawaideh Posted 5 months, 25 days and 7 hours ago

    I am unable to post comments next to the paragraphs.. is this the only place to do so?

  8. Constantine Posted 3 months, 10 days and 6 hours ago

    Unable to post individual comments, but on page http://rails-nutshell.labs.oreilly.com/ch01.html#id1978287 it says

    "With the server running in a terminal, vist http://localhost:3000 in a web browser. If everything is working correctly, you should be looking at a web page with some suggestions on how to get started writing your application.

    Follow its advice and use the script/generate command to create

    Looking at the nouns in the project description, it’s clear that a video is going to be a resource this application is going to use. Each video resource will have a title and some HTML embed code."

    Which has a sentence with no end or finishing punctuation.

Add a comment

Rails in a Nutshell is a concise introduction to Rails, an overview of commands and configurations, and a guide to the parts of Rails you’ll be using every day.

Full of examples and explanations, this book kicks your skills into high-gear by showing you how to take advantage of the Model-View-Controller concept with tiny but expressive bits of Ruby that power some of the world’s biggest and fastest web services.

Fast to launch and a pleasure to get there are hallmarks of working with Rails. Rails in a Nutshell gets the right stuff in your hands quickly and without fuss, so you can experience it yourself.

Follow the progress of the book on Twitter twitter.com/railsnutshell, at railsinanutshell.com, and at the book's catalog page.


1. Rails in a Nutshell
Architecture
Model
View
Controller
Mailer
Web Services
Plugins
Getting Started
View Helpers
Model Validations
Request Formats
View Layouts
Routes
Model Associations
Partials
AJAX & RJS
The Console
Summary
2. Active Model
Callbacks
Validations
When validations don't happen
Tracking Changes
3. Active Record
Your interface to Active Record
The database and its schema
Model definitions
Relations
Record instances
Connecting to a Database
A Model's Names
Developing your Database Schema with Migrations
Associations
belongs_to
has_one
Options
Associations as roles
Polymorphic associations
Single Table Inheritance
Aggregation
Creating
Finding the records you want
Constructing Relations
scoped
where
select
group & having
order
limit & offset
includes
eager_load
preload
joins
lock
readonly
create_with
from
only & except
Calculations
Updating
Deleting
Named Scopes
Transactions
Dynamic Scopes
Observers
4. Routing
Basic Routing
HTTP Verbs
Path Parameters
Optional Matching
Specifying Default Parameters
Constraints
Named Routes
Specifying a root Route
Scopes
Controller Scope
Resources
Singleton Resources
Nested Resources
Namespaces
Redirects
test
5. Action Controller
Getting Started
Record Identification
Responding to Requests
The HEAD Response
Rendering a Response
Redirecting
Response Headers
Cookies
Working with Cookies
Permanent Cookies
Signed Cookies
Sessions
Using the session
Session Stores
Configuration
Flash
Storing Objects in the Flash
Accessing the Flash from View Templates
Limiting an Object to the Current Request
Keeping the Flash for an Extra Request
Discarding the Flash at the End of the Current Request
Controller Callbacks
Before Filters
After Filters
Around Filters
Defining Filters
Limiting Filters to Particular Actions
Sending Files
6. Rack
Getting Started
Environment
Middleware
Rackup
run(app)
use(middleware, *args)
map(path){ block }
Using Rack in your Rails Application
The Rails Middleware Stack
Creating Custom Middleware
Installing Middleware
Routing to a Rack Application
7. Active Resource
Background
Client and Server
Web Service Client
Web Service Server
Finding Resources
Finding all resources
Finding a single resource by ID
Finding resources from custom paths
Creating Resources
Creating a resource
Validation and Errors
Updating Resources
Deleting Resource
Making Custom Requests
HTTP Authentication
8. Action Mailer
Sending Email
Mailers
Rendering the Email Body
Creating and Sending Mail
Generating URIs
HTML Email
Adding Attachments
Configuration
SMTP Delivery Options
Sendmail Delivery Options
File Delivery Options
Test Delivery Settings
Receiving Email
9. Active Support
MessageVerifier
MessageEncryptor
SecureRandom
Cache
Commonly Used Methods
Storage Implementations
Time, Date, and DateTime
Describing moments in time
Direct time duration manipulation
Is it in the future? Is it today? Is it in the past?
Time Arithmetic
Time Zone Conversions
Formatting Time-like objects
Days in a month
Memoizable
Enumerable
Array
Hash
Range
Numeric
Integer
Float
Callbacks
Base64
Gzip compression & decompression
JSON serialization
XML serialization
NilClass
Inflections
StringInquirer
Module
Class
Object
10. Testing
Terminology
Unit Tests
Assertions
Test Helper Methods
Fixtures
Functional Tests
View Tests
Routing Tests
Integration Tests
Creating an integration test
Integration testing commands
Testing the article workflow
Testing multiple sessions
Extending integration tests with helpers
Stubbing & Mocking
Stubbing a method
Stub & Mock Objects
Running tests
Using rake
Test environment
Debugging within a test
11. Plugins
Installing Plugins
Plugins as Gems
Plugin Listing
Delayed Job
Exception Notification
SSL Requirement
Writing a Plugin
Plugin Anatomy
Hooking into Rails
12. Production Environments
Rails Environments
Changing Environments
Server setup
Installing Passenger for Apache
Managing deployments
Common Capistrano tasks
Installing Capistrano
Configuring Capistrano
Server directory structure
Custom Environments
Deployment with JRuby
JRuby Advantages
JRuby Disadvantages
Getting started with JRuby on Rails
Running Rails on GlassFish
Running Multithreaded Rails
Create a Web Application Archive
13. Tools
Tools
cURL
14. Appendix
Configuration
Configuration
Environments
Action Mailer Configuration
Active Support Cache Store
Rails Initializers
Logging
Configuration
HTTP Status Codes
HTTP Status Code Mapping
Memcached
Installing Memcached
You must sign in or register before commenting

Atom Icon Comments on this page or Comments on the whole book.