You are previewing The Rails Way.
O'Reilly logo
The Rails Way

Book Description

The expert guide to building Ruby on Rails applications

Ruby on Rails strips complexity from the development process, enabling professional developers to focus on what matters most: delivering business value. Now, for the first time, there’s a comprehensive, authoritative guide to building production-quality software with Rails. Pioneering Rails developer Obie Fernandez and a team of experts illuminate the entire Rails API, along with the Ruby idioms, design approaches, libraries, and plug-ins that make Rails so valuable. Drawing on their unsurpassed experience, they address the real challenges development teams face, showing how to use Rails’ tools and best practices to maximize productivity and build polished applications users will enjoy.

Using detailed code examples, Obie systematically covers Rails’ key capabilities and subsystems. He presents advanced programming techniques, introduces open source libraries that facilitate easy Rails adoption, and offers important insights into testing and production deployment. Dive deep into the Rails codebase together, discovering why Rails behaves as it does– and how to make it behave the way you want it to.

This book will help you

Increase your productivity as a web developer

Realize the overall joy of programming with Ruby on Rails

Learn what’s new in Rails 2.0

Drive design and protect long-term maintainability with TestUnit and RSpec

Understand and manage complex program flow in Rails controllers

Leverage Rails’ support for designing REST-compliant APIs

Master sophisticated Rails routing concepts and techniques

Examine and troubleshoot Rails routing

Make the most of ActiveRecord object-relational mapping

Utilize Ajax within your Rails applications

Incorporate logins and authentication into your application

Extend Rails with the best third-party plug-ins and write your own

Integrate email services into your applications with ActionMailer

Choose the right Rails production configurations

Streamline deployment with Capistrano

Table of Contents

  1. Copyright
    1. Dedication
  2.  
  3. Addison-Wesley Professional Ruby Series
    1. Obie Fernandez, Series Editor
      1. Books currently in the series
      2. Short Cuts
      3. Video
  4. Foreword
  5. Acknowledgments
  6. About the Author
  7. Introduction
    1. Ruby and Rails
      1. The Rise of Rails and Mainstream Acceptance
      2. Enterprise Adoption
      3. Delivering Results
    2. About Opinionated Software
    3. About This Book
      1. Book Structure
      2. Sample Code and Listings
      3. Plugins
      4. Recommended Reading and Resources
      5. Regarding David Heinemeier Hansson a.k.a. DHH
      6. Goals
      7. Prerequisites
      8. Required Technology
      9. References
  8. 1. Rails Environments and Configuration
    1. Startup
      1. Default Environment Settings
        1. Mode Override
        2. Rails Gem Version
      2. Bootstrapping
      3. RubyGems
      4. Initializer
      5. Default Load Paths
      6. Rails, Modules, and Auto-Loading Code
      7. Builtin Rails Info
      8. Configuration
        1. Skipping Frameworks
        2. Additional Load Paths
        3. Log-Level Override
        4. ActiveRecord Session Store
        5. Schema Dumper
        6. Observers
        7. Time Zones
      9. Additional Configuration
    2. Development Mode
      1. Automatic Class Reloading
      2. The Rails Class Loader
    3. Test Mode
    4. Production Mode
    5. Logging
      1. Rails Log Files
      2. Log File Analysis
      3. Syslog
    6. Conclusion
    7. References
  9. 2. Working with Controllers
    1. The Dispatcher: Where It All Begins
      1. Request Handling
      2. Getting Intimate with the Dispatcher
    2. Render unto View...
      1. When in Doubt, Render
      2. Explicit Rendering
      3. Rendering Another Action’s Template
      4. Rendering a Different Template Altogether
      5. Rendering a Partial Template
      6. Rendering Inline Template Code
      7. Rendering Text
      8. Rendering Other Types of Structured Data
        1. :json
        2. :xml
      9. Rendering Nothing
      10. Rendering Options
        1. :content_type
        2. :layout
        3. :status
    3. Redirecting
    4. Controller/View Communication
    5. Filters
      1. Filter Inheritance
      2. Filter Types
        1. Filter Classes
        2. Inline Filter Method
      3. Filter Chain Ordering
      4. Around Filters
      5. Filter Chain Skipping
      6. Filter Conditions
      7. Filter Chain Halting
    6. Streaming
      1. send_data(data, options = {})
        1. Options for send_data
        2. Usage Examples
      2. send_file(path, options = {})
        1. Options for send_file
        2. Usage Examples
      3. Letting the Web Server Send Files
    7. Conclusion
    8. References
  10. 3. Routing
    1. The Two Purposes of Routing
    2. Bound Parameters
    3. Wildcard Components (“Receptors”)
    4. Static Strings
    5. The routes.rb File
      1. The Default Route
      2. Spotlight on the :id Field
      3. Default Route Generation
      4. Modifying the Default Route
    6. The Ante-Default Route and respond_to
      1. respond_to and the HTTP-Accept Header
    7. The Empty Route
    8. Writing Custom Routes
    9. Using Static Strings
    10. Using Your Own “Receptors”
    11. A Note on Route Order
    12. Using Regular Expressions in Routes
    13. Default Parameters and the url_for Method
      1. What Happened to :id?
    14. Using Literal URLs
    15. Route Globbing
    16. Globbing Key-Value Pairs
    17. Named Routes
      1. Creating a Named Route
      2. The Question of Using name_path Versus name_url
      3. Considerations
    18. What to Name Your Routes
      1. Argument Sugar
      2. A Little More Sugar with Your Sugar?
    19. The Special Scope Method with_options
    20. Conclusion
    21. References
  11. 4. REST, Resources, and Rails
    1. REST in a Rather Small Nutshell
    2. REST in Rails
    3. Routing and CRUD
    4. Resources and Representations
      1. REST Resources and Rails
      2. From Named Routes to REST Support
      3. Reenter the HTTP Verb
    5. The Standard RESTful Controller Actions
      1. The PUT and DELETE Cheat
      2. Singular and Plural RESTful Routes
      3. The Special Pairs: new/create and edit/update
    6. Singular Resource Routes
    7. Nested Resources
      1. Setting :path_prefix Explicitly
      2. Setting :name_prefix Explicitly
      3. Specifying RESTful Controllers Explicitly
      4. All Together Now
      5. Considerations
      6. Deep Nesting?
    8. RESTful Route Customizations
      1. Extra Member Routes
      2. Extra Collection Routes
      3. Considerations
    9. Controller-Only Resources
    10. Different Representations of Resources
      1. The respond_to Method
      2. Formatted Named Routes
    11. The RESTful Rails Action Set
      1. Index
      2. Show
      3. Destroy
      4. New and Create
      5. Edit and Update
    12. Conclusion
    13. Reference
  12. 5. Reflecting on Rails Routing
    1. Examining Routes in the Application Console
      1. Dumping Routes
      2. Anatomy of a Route Object
      3. Recognition and Generation in the Console
      4. Named Routes in the Console
    2. Testing Routes
    3. The Routing Navigator Plugin
    4. Conclusion
    5. References
  13. 6. Working with ActiveRecord
    1. The Basics
    2. Migrations
      1. Creating Migrations
        1. Naming Migrations
        2. Migration Pitfalls
      2. Migration API
        1. create_table(name, options)
      3. Defining Columns
        1. Column Type Mappings
        2. Column Options
        3. Decimal Precision
        4. Column Type Gotchas
        5. Custom Data Types
        6. “Magic” Timestamp Columns
    3. Macro-Style Methods
      1. Relationship Declarations
      2. Convention over Configuration
      3. Pluralization
        1. Should I Report INFLECTOR Bugs to the Core Team?
      4. Setting Names Manually
      5. Legacy Naming Schemes
    4. Defining Attributes
      1. Default Attribute Values
      2. Serialized Attributes
    5. CRUD: Creating, Reading, Updating, Deleting
      1. Creating New ActiveRecord Instances
      2. Reading ActiveRecord Objects
        1. find
      3. Reading and Writing Attributes
        1. Hash Notation
        2. The attributes Method
      4. Accessing and Manipulating Attributes Before They Are Typecast
      5. Reloading
      6. Dynamic Attribute-Based Finders
      7. Custom SQL Queries
      8. The Query Cache
        1. Logging
        2. Default Query Caching in Controllers
        3. Limitations
      9. Updating
      10. Updating by Condition
      11. Updating a Particular Instance
      12. Updating Specific Attributes
      13. Convenience Updaters
      14. Controlling Access to Attributes
      15. Deleting and Destroying
    6. Database Locking
      1. Optimistic Locking
        1. Handling StaleObjectError
      2. Pessimistic Locking
      3. Considerations
    7. Advanced Finding
      1. Conditions
        1. Boolean Conditions
      2. Ordering of Find Results
        1. Random Ordering
      3. Limit and Offset
      4. Select Option
      5. From Option
      6. Group By Option
      7. Locking Option
      8. Joining and Including Associations
      9. Read Only
    8. Connections to Multiple Databases in Different Models
    9. Using the Database Connection Directly
      1. The DatabaseStatements Module
        1. begin_db_transaction()
        2. commit_db_transaction()
        3. delete(sql_statement)
        4. execute(sql_statement)
        5. insert(sql_statement)
        6. reset_sequence!(table, column, sequence = nil)
        7. rollback_db_transaction()
        8. select_all(sql_statement)
        9. select_one(sql_statement)
        10. select_value(sql_statement)
        11. select_values(sql_statement)
        12. update(sql_statement)
      2. Other Connection Methods
        1. active?
        2. adapter_name
        3. disconnect! and reconnect!
        4. raw_connection
        5. supports_count_distinct?
        6. supports_migrations?
        7. tables
        8. verify!(timeout)
    10. Other Configuration Options
    11. Conclusion
    12. References
  14. 7. ActiveRecord Associations
    1. The Association Hierarchy
    2. One-to-Many Relationships
      1. Adding Associated Objects to a Collection
      2. AssociationCollection Methods
        1. <<(*records) and create(attributes = {})
        2. clear
        3. delete(*records) and delete_all
        4. destroy_all
        5. length
        6. replace(other_array)
        7. size
        8. sum(column, *options)
        9. uniq
    3. The belongs_to Association
      1. Reloading the Association
      2. Building and Creating Related Objects via the Association
      3. belongs_to Options
        1. :class_name
        2. :conditions
        3. :foreign_key
        4. :counter_cache
        5. :include
        6. :polymorphic => true
    4. The has_many Association
      1. has_many Options
        1. :after_add
        2. :after_remove
        3. :as
        4. :before_add
        5. :before_remove
        6. :class_name
        7. :conditions
        8. :counter_sql
        9. :delete_sql
        10. :dependent => :delete_all
        11. :dependent => :destroy_all
        12. :dependent => :nullify
        13. :exclusively_dependent
        14. :extend => ExtensionModule
        15. :finder_sql
        16. :foreign_key
        17. :group
        18. :include
        19. :insert_sql
        20. :limit
        21. :offset
        22. :order
        23. :select
        24. :source and :source_type
        25. :table_name
        26. :through
        27. :uniq => true
      2. Proxy Methods
        1. build(attributes = {})
        2. count(*args)
        3. find(*args)
    5. Many-to-Many Relationships
      1. has_and_belongs_to_many
        1. Self-Referential Relationship
        2. Bidirectional Relationships
        3. Custom SQL Options
        4. Extra Columns on has_and_belongs_to_many Join Tables
        5. “Real Join Models” and habtm
      2. has_many :through
        1. Join Models
        2. Usage Considerations and Examples
        3. Aggregating Associations
        4. Join Models and Validations
      3. has_many :through Options
        1. :source
        2. :source_type
        3. :uniq
    6. One-to-One Relationships
      1. has_one
      2. has_one Options
        1. :as
        2. :class_name
        3. :conditions
        4. :dependent
        5. :foreign_key
        6. :include
        7. :order
    7. Unsaved Objects and Associations
      1. One-to-One Associations
      2. Collections
    8. Association Extensions
    9. The AssociationProxy Class
      1. reload and reset
      2. proxy_owner, proxy_reflection, and proxy_target
    10. Conclusion
    11. References
  15. 8. ActiveRecord Validations
    1. Finding Errors
    2. The Simple Declarative Validations
      1. validates_acceptance_of
        1. Error Message
        2. The accept Option
      2. validates_associated
      3. validates_confirmation_of
      4. validates_each
      5. validates_inclusion_of and validates_exclusion_of
      6. validates_existence_of
      7. validates_format_of
      8. validates_length_of
        1. Constraint Options
        2. Error Message Options
      9. validates_numericality_of
      10. validates_presence_of
        1. Validating the Presence of Associated Objects
      11. validates_uniqueness_of
        1. Enforcing Uniqueness of Join Models
      12. RecordInvalid
    3. Common Validation Options
      1. :allow_nil
      2. :if
      3. :message
      4. :on
    4. Conditional Validation
      1. Usage and Considerations
    5. Working with the Errors Object
      1. Manipulating the Errors Collection
        1. add_to_base(msg)
        2. add(attribute, msg)
        3. clear
      2. Checking for Errors
        1. invalid?(attribute)
        2. on(attribute)
    6. Custom Validation
    7. Skipping Validations
    8. Conclusion
    9. Reference
  16. 9. Advanced ActiveRecord
    1. Callbacks
      1. Callback Registration
        1. One-Liners
        2. Protected or Private
      2. Matched before/after Callbacks
        1. List of Callbacks
      3. Halting Execution
      4. Callback Usages
        1. Cleaning Up Attribute Formatting with before_validate_on_create
        2. Geocoding with before_save
        3. Paranoia with before_destroy
        4. Cleaning Up Associated Files with after_destroy
      5. Special Callbacks: after_initialize and after_find
      6. Callback Classes
        1. Multiple Callback Methods in One Class
        2. Testability
    2. Observers
      1. Naming Conventions
      2. Registration of Observers
      3. Timing
    3. Single-Table Inheritance (STI)
      1. Mapping Inheritance to the Database
      2. STI Considerations
      3. STI and Associations
    4. Abstract Base Model Classes
    5. Polymorphic has_many Relationships
      1. In the Case of Models with Comments
        1. The Interface
        2. The Database Columns
        3. Has_many :through and Polymorphics
      2. Considerations about has_many
    6. Modules for Reusing Common Behavior
      1. A Review of Class Scope and Contexts
      2. The included Callback
    7. Modifying ActiveRecord Classes at Runtime
      1. Considerations
      2. Ruby and Domain-Specific Languages
    8. Conclusion
    9. References
  17. 10. ActionView
    1. ERb Basics
      1. ERb Practice
      2. Tightening Up ERb Output
      3. Commenting Out ERb Delimiters
      4. Conditional Output
      5. RHTML? RXML? RJS?
    2. Layouts and Templates
      1. Yielding Content
      2. Template Variables
        1. Instance Variables
        2. assigns
        3. base_path
        4. controller
        5. flash
        6. headers
        7. logger
        8. params
        9. request and response
        10. session
      3. Protecting the Integrity of Your View from User-Submitted Content
    3. Partials
      1. Simple Use Cases
      2. Reuse of Partials
      3. Shared Partials
      4. Passing Variables to Partials
        1. The local_assigns Hash
      5. Render Collections
        1. The partial_counter Variable
        2. Sharing Collection Partials
      6. Logging
    4. Caching
      1. Caching in Development Mode?
      2. Page Caching
      3. Action Caching
        1. Design Considerations
      4. Fragment Caching
        1. The cache Method
        2. Named Fragments
        3. Global Fragments
        4. Avoiding Extra Database Activity
      5. Expiration of Cached Content
        1. Expiring Pages and Actions
        2. Expiring Fragments
        3. Using regular expressions in expiration calls
      6. Automatic Cache Expiry with Sweepers
      7. Cache Logging
      8. Action Cache Plugin
      9. Cache Storage
        1. Configuration Example
        2. Limitations of File-Based Storage
        3. Manual Sweeping with rake
    5. Conclusion
    6. References
  18. 11. All About Helpers
    1. ActiveRecordHelper
      1. Reporting Validation Errors
        1. error_message_on(object, method, prepend_text = "", append_text = "", css_class = "formError")
        2. error_messages_for(*params)
      2. Automatic Form Creation
        1. form(name, options)
        2. input(name, method, options)
      3. Customizing the Way Validation Errors Are Highlighted
    2. AssetTagHelper
      1. Head Helpers
        1. auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {})
        2. image_path(source)
        3. image_tag(source, options = {})
        4. javascript_include_tag(*sources)
        5. javascript_path(source)
        6. stylesheet_link_tag(*sources)
        7. stylesheet_path(source)
      2. For Plugins Only, Add Default JavaScript Includes
    3. BenchmarkHelper
      1. benchmark(message = "Benchmarking", level = :info)
    4. CacheHelper
    5. CaptureHelper
      1. capture(&block)
      2. content_for(name, &block)
    6. DateHelper
      1. The Date and Time Selection Helpers
        1. date_select(object_name, method, options = {})
        2. datetime_select(object_name, method, options = {})
        3. time_select(object_name, method, options = {})
      2. The Individual Date and Time Select Helpers
        1. select_date(date = Date.today, options = {})
        2. select_datetime(datetime = Time.now, options = {})
        3. select_day(date, options = {})
        4. select_hour(datetime, options = {})
        5. select_minute(datetime, options = {})
        6. select_month(date, options = {})
        7. select_second(datetime, options = {})
        8. select_time(datetime, options = {})
        9. select_year(date, options = {})
      3. Common Options for Date Selection Helpers
      4. distance_in_time Methods with Complex Descriptive Names
        1. distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)
        2. distance_of_time_in_words_to_now(from_time, include_seconds = false)
    7. DebugHelper
    8. FormHelper
      1. Creating Forms for ActiveRecord Models
        1. Variables Are Optional
        2. Rails-Generated Form Conventions
        3. Displaying Existing Values
        4. Updating Multiple Objects at Once
        5. Square Brackets with New Records?
        6. Indexed Input Fields
        7. Faux Accessors
      2. How Form Helpers Get Their Values
    9. FormOptionsHelper
      1. Select Helpers
        1. collection_select(object, attribute, collection, value_method, text_method, options = {}, html_options = {})
        2. country_select(object, attribute, priority_countries = nil, options = {}, html_options = {})
        3. select(object, attribute, choices, options = {}, html_options = {})
        4. time_zone_select(object, method, priority_zones = nil, options = {}, html_options = {})
      2. Option Helpers
        1. country_options_for_select(selected = nil, priority_countries = nil)
        2. option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = nil)
        3. options_for_select(container, selected = nil)
        4. options_from_collection_for_select(collection, value_method, text_method, selected=nil)
        5. time_zone_options_for_select(selected = nil, priority_zones = nil, model = TimeZone)
    10. FormTagHelper
      1. check_box_tag(name, value = "1", checked = false, options = {})
      2. end_form_tag
      3. file_field_tag(name, options = {})
      4. form_tag(url_for_options = {}, options = {}, *parameters_for_url, &block)
      5. hidden_field_tag(name, value = nil, options = {})
      6. image_submit_tag(source, options = {})
      7. password_field_tag(name = "password", value = nil, options = {})
      8. radio_button_tag(name, value, checked = false, options = {})
      9. select_tag(name, option_tags = nil, options = {})
      10. start_form_tag
      11. submit_tag(value = "Save changes", options = {})
      12. text_area_tag(name, content = nil, options = {})
      13. text_field_tag(name, value = nil, options = {})
    11. JavaScriptHelper
      1. button_to_function(name, function, html_options={}, &block)
      2. define_javascript_functions()
      3. escape_javascript(javascript)
      4. javascript_tag(content, html_options={})
      5. link_to_function(name, function, html_options={}, &block)
    12. NumberHelper
      1. human_size(size, precision=1)
      2. number_to_currency(number, options = {})
      3. number_to_human_size(size, precision=1)
      4. number_to_percentage(number, options = {})
      5. number_to_phone(number, options = {})
      6. number_with_delimiter(number, delimiter=",", separator=".")
      7. number_with_precision(number, precision=3)
    13. PaginationHelper
      1. will_paginate
      2. paginator
      3. Paginating Find
    14. RecordIdentificationHelper
      1. dom_class(record_or_class, prefix = nil)
      2. dom_id(record, prefix = nil)
      3. partial_path(record_or_class)
    15. RecordTagHelper
      1. content_tag_for(tag_name, record, *args, &block)
      2. div_for(record, *args, &block)
    16. TagHelper
      1. cdata_section(content)
      2. content_tag(name, content = nil, options = nil, &block)
      3. escape_once(html)
      4. tag(name, options = nil, open = false)
    17. TextHelper
      1. auto_link(text, link = :all, href_options = {}, &block)
      2. concat(string, binding)
      3. cycle(first_value, *values)
      4. excerpt(text, phrase, radius = 100, excerpt_string = "...")
      5. highlight(text, phrases, highlighter = '<strong class="highlight">\1</strong>')
      6. markdown(text)
      7. pluralize(count, singular, plural = nil)
      8. reset_cycle(name = "default")
      9. sanitize(html)
      10. simple_format(text)
      11. strip_links(text)
      12. strip_tags(html)
      13. textilize(text)
      14. textilize_without_paragraph(text)
      15. truncate(text, length = 30, truncate_string = "...")
      16. word_wrap(text, line_width = 80)
    18. UrlHelper
      1. button_to(name, options = {}, html_options = {})
      2. current_page?(options)
      3. link_to(name, options = {}, html_options = nil)
      4. link_to_if(condition, name, options = {}, html_options = {}, &block)
      5. link_to_unless(condition, name, options = {}, html_options = {}, &block)
      6. link_to_unless_current(name, options = {}, html_options = {}, &block)
      7. mail_to(email_address, name = nil, html_options = {})
      8. url_for(options = {})
      9. Relying on Named Routes
    19. Writing Your Own Helpers
      1. Small Optimizations: The Title Helper
      2. Encapsulating View Logic: The photo_for Helper
      3. Smart View: The breadcrumbs Helper
    20. Wrapping and Generalizing Partials
      1. A tiles Helper
        1. Explanation of the Tiles Partial Code
        2. Calling the Tiles Partial Code
        3. Write the Helper Method
      2. Generalizing Partials
        1. Lambda: the Ultimate
        2. The New Tiled Helper Method
    21. Conclusion
    22. References
  19. 12. Ajax on Rails
    1. Prototype
      1. FireBug
      2. The Prototype API
      3. Top-Level Functions
        1. $(id[, id2...])
        2. $$(expr[, expr2...])
        3. $A(var)
        4. $F(id)
        5. $H(obj)
        6. $R(start, end, exclusive)
        7. Try.these(func1, func2[, func3...]
      4. Class
      5. Extensions to JavaScript’s Object Class
        1. Object.clone(object)
        2. Object.extend(destination, source)
        3. Object.keys(obj) and Object.values(obj)
        4. Object.inspect(param)
      6. Extensions to JavaScript’s Array Class
        1. array.clear()
        2. array.compact()
        3. array.first() and array.last()
        4. array.flatten()
        5. array.indexOf(object)
        6. array.inspect()
        7. array.reverse(inline)
        8. array.shift()
        9. array.without(obj1[, obj2, ...])
      7. Extensions to the document Object
      8. Extensions to the Event Class
        1. Event.element()
        2. Event.findElement(event, tagName)
        3. Event.isLeftClick(event)
        4. Event.observe(element, name, observer, useCapture) and Event.stopObserving(element, name, observer, useCapture)
        5. Event.pointerX(event) and Event.pointerY(event)
        6. Event.stop(event)
      9. Extensions to JavaScript’s Function Class
        1. function.bind(obj)
        2. function.bindAsEventListener(obj)
      10. Extensions to JavaScript’s Number Class
        1. number.toColorPart()
        2. number.succ()
        3. number.times()
      11. Extensions to JavaScript’s String class
        1. string.camelize()
        2. string.dasherize()
        3. string.escapeHTML() and string.unescapeHTML()
        4. string.evalScripts() and string.extractScripts()
        5. string.gsub(pattern, replacement) and string.sub (pattern, replacement, count)
        6. string.scan(pattern, iterator)
        7. string.strip()
        8. string.stripScripts() and string.stripTags()
        9. string.parseQuery() and string.toQueryParams()
        10. string.toArray()
        11. string.truncate(length, truncationString)
        12. string.underscore()
      12. The Ajax Object
        1. Ajax.activeRequestCount
        2. Ajax.getTransport()
      13. Ajax.Responders
        1. Ajax.Responders.register(responder)
        2. Ajax.Responders.unregister(responder)
      14. Enumerable
        1. enumerable.each(iterator)
        2. enumerable.all(iterator)
        3. enumerable.any(iterator)
        4. enumerable.collect(iterator) and enumerable.map(iterator)
        5. enumerable.detect(iterator) and enumerable.find(iterator)
        6. enumerable.eachSlice(number[, iterator])
        7. enumerable.findAll(iterator) and enumerable.select (iterator)
        8. enumerable.grep(pattern[, iterator])
        9. enumerable.include(obj) and enumerable.member(obj)
        10. enumerable.inGroupsOf(num[, filler])
        11. enumerable.inject(accumulator, iterator)
        12. enumerable.invoke(functionName[, arg1, arg2...])
        13. enumerable.max([iterator]) and enumerable.min([iterator])
        14. enumerable.partition([iterator])
        15. enumerable.pluck(propertyName)
        16. enumerable.reject(iterator)
        17. enumerable.sortBy(iterator)
        18. enumerable.toArray() and enumerable.entries()
        19. enumerable.zip(enum1, enum2[, enum3...][, iterator])
      15. Hash
        1. hash.keys() and hash.values()
        2. hash.merge(another)
        3. hash.toQueryString()
      16. ObjectRange
      17. The Prototype Object
    2. The PrototypeHelper Module
      1. link_to_remote
      2. remote_form_for
      3. periodically_call_remote
      4. observe_field
      5. observe_form
    3. RJS—Writing Javascript in Ruby
      1. RJS Templates
      2. <<(javascript)
      3. [](id)
      4. alert(message)
      5. call(function, *arguments, &block)
      6. delay(seconds = 1) { ... }
      7. draggable(id, options = {})
      8. drop_receiving(id, options = {})
      9. hide(*ids)
      10. insert_html(position, id, *options_for_render)
      11. literal(code)
      12. redirect_to(location)
      13. remove(*ids)
      14. replace(id, *options_for_render)
      15. replace_html(id, *options_for_render)
      16. select(pattern)
      17. show(*ids)
      18. sortable(id, options = {})
      19. toggle(*ids)
      20. visual_effect(name, id = nil, options = {})
    4. JSON
    5. Drag and Drop
    6. Sortable
    7. Autocompleter
    8. In-Place Editors
    9. Conclusion
    10. References
  20. 13. Session Management
    1. What to Store in the Session
      1. The Current User
      2. Session Use Guidelines
    2. Session Options
      1. Disabling Sessions for Robots
      2. Selectively Enabling Sessions
      3. Secure Sessions
    3. Storage Mechanisms
      1. ActiveRecord SessionStore
      2. PStore (File-Based)
      3. DRb Session Storage
      4. memcache Session Storage
      5. The Controversial CookieStore
    4. Timing Out and Session Life Cycle
      1. Session Timeout Plugin for Rails
      2. Tracking Active Sessions
      3. Enhanced Session Security
      4. Cleaning Up Old Sessions
    5. Cookies
      1. Reading and Writing Cookies
    6. Conclusion
    7. References
  21. 14. Login and Authentication
    1. Acts as Authenticated
      1. Installation and Setup
      2. The User Model
        1. Non-Database Attributes
        2. Validations
        3. The before_save Callback
        4. The authenticate Method
        5. The remember_token
      3. The Account Controller
      4. Login from Cookie
      5. The Current User
    2. Logging In During Testing
    3. Conclusion
    4. References
  22. 15. XML and ActiveResource
    1. The to_xml Method
      1. Customizing to_xml Output
      2. Associations and to_xml
      3. Advanced to_xml
      4. Dynamic Runtime Attributes
      5. Overriding to_xml
      6. Learning from Array’s to_xml Method
    2. The XML Builder
    3. Parsing XML
      1. Turning XML into Hashes
      2. XmlSimple
      3. Typecasting
    4. ActiveResource
      1. Find
      2. Create
      3. Update
      4. Delete
      5. Headers
      6. Customizing
      7. Hash Forms
    5. Conclusion
  23. 16. ActionMailer
    1. Setup
    2. Mailer Models
      1. Preparing Outbound Email Messages
        1. attachment
        2. bcc
        3. body
        4. cc
        5. charset
        6. content_type
        7. from
        8. headers
        9. implicit_parts_order
        10. mailer_name
        11. mime_version
        12. part
        13. recipients
        14. sent_on
        15. subject
        16. template
      2. HTML Email Messages
      3. Multipart Messages
        1. Part Options
        2. Implicit Multipart Messages
      4. File Attachments
      5. Actually Sending an Email
    3. Receiving E-Mails
      1. TMail::Mail API Reference
        1. attachments
        2. body
        3. date
        4. has_attachments?
        5. multipart?
        6. parts
        7. subject
        8. to
      2. Handling Attachments
    4. Configuration
    5. Conclusion
    6. References
  24. 17. Testing
    1. Rails Testing Terminology
      1. So Much for Isolation...
      2. Rails Mocks?
      3. Real Mocks and Stubs
      4. Integration Tests
      5. Dealing with the Confusion
    2. Test::Unit
      1. Running Tests
    3. Fixtures
      1. CSV Fixtures
      2. Accessing Fixture Records from Tests
      3. Dynamic Fixture Data
      4. Using Fixture Data in Development Mode
      5. Generating Fixtures from Development Data
      6. Fixtures Options
      7. Everybody Hates Fixtures
        1. Fixtures Make My Test Suite Slow
        2. Fixtures Allow Invalid Data
        3. Maintainability Challenges
        4. Fixtures Are Brittle
      8. Fixtures Really Aren’t That Bad
    4. Assertions
      1. Basic Assertions
        1. assert and deny
        2. assert_block
        3. assert_empty
        4. assert_equal and assert_not_equal
        5. assert_in_delta and assert_in_epsilon
        6. assert_include
        7. assert_instance_of
        8. assert_kind_of
        9. assert_match and assert_no_match
        10. assert_nil and assert_not_nil
        11. assert_same and assert_not_same
        12. assert_raise and assert_nothing_raised
        13. assert_respond_to
        14. flunk
      2. Rails Assertions
      3. One Assertion per Test Method
    5. Testing Models with Unit Tests
      1. Model Testing Basics
      2. Deciding What to Test
    6. Testing Controllers with Functional Tests
      1. Structure and Setup
      2. Functional Test Methods
      3. Common Assertions
        1. Assert That Variables Were Assigned Properly for Use by Templates
        2. Assert the HTTP Status Code of a Response and Its MIME Content Type
        3. Assert the MIME Content Type of a Response (or Other Header Values)
        4. Assert Rendering of a Particular Template
        5. Assert Redirection to a Specified URL
        6. Assert Setting of Flash Messages
        7. Assert Database Changes Resulting from Actions
        8. Assert Validity of a Model
        9. Asserting View Output
    7. Testing Views with Functional Tests
      1. assert_select(selector, [*values, equality, message, &block])
      2. assert_select(element, selector, [*values, equality, message, &block])
      3. Optional Block Parameter
      4. Selector Reference
      5. Equality Tests
      6. Testing RJS Behavior
        1. assert_select_rjs(*args, &block)
        2. assert_select_rjs(id)
        3. assert_select_rjs(operation, id)
        4. assert_select_rjs(:insert, position, id)
      7. Other Selection Methods
        1. assert_select_email(*args, &block)
        2. assert_select_encoded(*args, &block)
        3. css_select(selector, *values) and css_select(element, selector, *values)
      8. Testing Routing Rules
        1. assert_generates(expected_path, options, defaults={}, extras = {}, message=nil)
        2. assert_recognizes(expected_options, path, extras={}, message=nil)
        3. assert_routing(path, options, defaults={}, extras={}, message=nil)
    8. Rails Integration Tests
      1. Basics
      2. The Integration Test API
        1. assert_redirected_to(options = {}, message = nil)
        2. assert_response(type, message = nil)
        3. assert_template(expected = nil, message = nil)
      3. Working with Sessions
    9. Rake Tasks Related to Testing
    10. Acceptance Tests
      1. Acceptance Test First?
    11. Selenium
      1. Basics
        1. Actions and Assertions
        2. Locators
        3. Patterns
        4. Selenium Reference
      2. Getting Started
        1. First Test
      3. RSelenese
        1. Partial Scripts
    12. Conclusion
    13. References
  25. 18. RSpec on Rails
    1. Introduction to RSpec
      1. Should and Expectations
      2. Predicates
      3. Custom Expectation Matchers
      4. Multiple Examples per Behavior
      5. Shared Behaviors
      6. RSpec’s Mocks and Stubs
        1. Mock Objects
        2. Null Objects
        3. Stub Objects
      7. Running Specs
      8. Installing RSpec and the RSpec on Rails Plugin
    2. The RSpec on Rails Plugin
      1. Generators
      2. Model Specs
      3. Controller Specs
        1. Isolation and Integration Modes
        2. Specifying Errors
        3. Specifying Routes
      4. View Specs
        1. Assigning Instance Variables
        2. Stubbing Helper Methods
      5. Helper Specs
      6. Scaffolding
    3. RSpec Tools
      1. Autotest
      2. RCov
    4. Conclusion
    5. References
  26. 19. Extending Rails with Plugins
    1. Managing Plugins
      1. Reusing Code
      2. The Plugin Script
        1. script/plugin list
        2. script/plugin sources
        3. script/plugin source [url [url2 [...]]]
        4. script/plugin unsource [url[url2 [...]]]
        5. script/plugin discover [url]
        6. script/plugin install [plugin]
        7. script/plugin remove [plugin]
        8. script/plugin update [plugin]
      3. Subversion and script/plugin
        1. Checking Out a Plugin
        2. script/plugin update
        3. SVN Externals
        4. Locking Down a Specific Version
    2. Using Piston
      1. Installation
      2. Importing a Vendor Library
      3. Converting Existing Vendor Libraries
      4. Updating
      5. Locking and Unlocking Revisions
      6. Piston Properties
    3. Writing Your Own Plugins
      1. The init.rb Hook
      2. The lib Directory
      3. Extending Rails Classes
      4. The README and MIT-LICENSE File
      5. The install.rb and uninstall.rb Files
        1. Installation
        2. Removal
        3. Common Sense Reminder
      6. Custom Rake Tasks
      7. The Plugin’s Rakefile
      8. Testing Plugins
    4. Conclusion
    5. References
  27. 20. Rails Production Configurations
    1. A Brief History of Rails In Production
    2. Some Basic Prerequisites
    3. The Stack Checklist
      1. Server and Network Environment
        1. Standalone/Dedicated Server or VPS Slice
        2. Fresh OS Install
        3. Network Access
      2. Web Tier
      3. Application Tier
      4. Database Tier
      5. Monitoring
      6. Version Control
    4. Installations
      1. Ruby
      2. RubyGems
      3. Rails
      4. Mongrel
      5. Mongrel Cluster
      6. Nginx
      7. Subversion
      8. MySQL
      9. Monit
      10. Capistrano
    5. Configurations
      1. Configuring Mongrel Cluster
      2. Configuring Nginx
        1. nginx.conf
        2. railsway.conf
      3. Configuring Monit
      4. Configuring Capistrano
    6. Configuring init Scripts
      1. Nginx init Script
      2. Mongrel init Script
      3. Monit Configuration
    7. Deployment and Launch
    8. Other Production Stack Considerations
      1. Redundancy and Failover
      2. Caching
      3. Performance and Scalability
      4. Security
        1. Application Security
        2. Lock Down Your Ports
      5. Maintainability
    9. Conclusion
    10. References
  28. 21. Capistrano
    1. Overview of Capistrano
      1. Terminology
      2. The Basics
        1. What Do I Need to Do to Use Capistrano?
        2. What Does Capistrano Expect?
      3. What Has Capistrano Done and What Hasn’t It?
    2. Getting Started
      1. Installation
      2. “Capify” Your Rails Application
      3. Configuring the Deployment
        1. Name Your Application
        2. Repository Info
        3. Define Roles
        4. Extra Role Properties
      4. A Little Spin, Please...
      5. Set Up the Deployment Machine
        1. Deployment Directory Structure
        2. Symbolic Links
        3. Checking a New Deployment Setup
      6. Deploy!
    3. Overriding Capistrano Assumptions
      1. Using a Remote User Account
      2. Customizing the SCM System Used by Capistrano
      3. Working without SCM Access from the Deployment Machine
      4. What If I Don’t Store database.yml in My SCM Repository?
        1. Option A: Version It Anyway, but with a Different Name
        2. Option B: Store Production-Ready database.yml in the shared/config Folder
        3. Option C: The Best Option: Autogenerate database.yml
      5. What If My Migrations Won’t Run from 0 to 100?
    4. Useful Capistrano Recipes
      1. Variables and Their Scope
      2. Exercise #1: Staging
      3. Exercise #2: Managing Other Services
    5. Multiserver Deployments
    6. Transactions
    7. Proxied Access to Deployment Machines
    8. Conclusion
    9. References
  29. 22. Background Processing
    1. script/runner
      1. Getting Started
      2. Usage Notes
      3. script/runner Considerations
    2. DRb
      1. A Simple DRb Server
      2. Using DRb from Rails
      3. DRb Considerations
      4. Resources
    3. BackgrounDRb
      1. Getting Started
      2. Configuration
      3. Understanding BackgrounDRb
      4. Using the MiddleMan
      5. Caveats
      6. BackGrounDRb Considerations
    4. Daemons
      1. Usage
      2. Introducing Threads
      3. Daemon Considerations
    5. Conclusion
    6. References
  30. A. ActiveSupport API Reference
    1. Array
      1. Public Instance Methods
        1. blank?
    2. Array::Conversions (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. to_formatted_s(format = :default)
        2. to_param
        3. to_sentence(options = {})
        4. to_xml(options = {}) {|xml if block_given?| ...}
    3. Array::ExtractOptions (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. extract_options!
    4. Array::Grouping (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. in_groups_of(number, fill_with = nil) {|group| ...}
        2. split(value = nil, &block)
    5. CachingTools::HashCaching (in ActiveSupport)
      1. Public Instance Methods
        1. hash_cache(method_name, options = {})
    6. Class
      1. Public Instance Methods
        1. cattr_accessor(*syms)
        2. cattr_reader(*syms)
        3. cattr_writer(*syms)
        4. class_inheritable_accessor(*syms)
        5. class_inheritable_array
        6. class_inheritable_hash
        7. class_inheritable_reader(*syms)
        8. class_inheritable_writer(*syms)
        9. const_missing(class_id)
        10. remove_class(*klasses)
        11. remove_subclasses
        12. subclasses
    7. CGI::EscapeSkippingSlashes (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. escape_skipping_slashes(str)
    8. Date::Behavior (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. acts_like_date?
    9. Date::Calculations (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. + (other)
        2. advance(options)
        3. ago(seconds)
        4. at_beginning_of_day, at_midnight, beginning_of_day, and midnight
        5. at_beginning_of_month and beginning_of_month
        6. at_beginning_of_quarter and beginning_of_quarter
        7. at_beginning_of_week, beginning_of_week, and monday
        8. at_beginning_of_year and beginning_of_year
        9. at_end_of_month and end_of_month
        10. change(options)
        11. end_of_day()
        12. in(seconds) and since(seconds)
        13. last_month()
        14. last_year()
        15. months_ago(months)
        16. months_since(months)
        17. next_month()
        18. next_week(day = :monday)
        19. next_year()
        20. tomorrow()
        21. years_ago(years)
        22. years_since(years)
        23. yesterday()
    10. Date::Conversions (in ActiveSupport::CoreExtensions)
      1. Constants
      2. Public Instance Methods
        1. to_date
        2. to_datetime
        3. to_formatted_s(format = :default)
        4. to_time(timezone = :local)
        5. xmlschema
    11. DateTime::Calculations (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. at_beginning_of_day, at_midnight, beginning_of_day, midnight
        2. advance(options)
        3. ago(seconds)
        4. change(options)
        5. end_of_day
        6. seconds_since_midnight
        7. since(seconds)
    12. DateTime::Conversions (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. readable_inspect
        2. to_date
        3. to_datetime
        4. to_formatted_s(format=:default)
        5. to_time
    13. Dependencies (in ActiveSupport)
      1. Module Attributes
        1. autoloaded_constants
        2. clear
        3. constant_watch_stack
        4. explicitly_unloadable_constants
        5. history
        6. load_once_paths
        7. load_paths
        8. loaded
        9. log_activity
        10. mechanism
        11. warnings_on_first_load
      2. Public Instance Methods
        1. associate_with(file_name)
        2. autoload_module!(into, const_name, qualified_name, path_suffix)
        3. autoloadable_module?(path_suffix)
        4. autoloaded?(constant)
        5. depend_on(file_name, swallow_load_errors = false)
        6. load?
        7. load_file(path, const_paths = loadable_constants_for_path(path))
        8. load_once_path?(path)
        9. load_missing_constant(mod, const_name)
        10. loadable_constants_for_path(path, bases = load_paths)
        11. mark_for_unload(constant)
        12. new_constants_in(*descs) {...}
        13. qualified_const_defined?(path)
        14. qualified_name_for(parent_module, constant_name)
        15. remove_unloadable_constants!
        16. require_or_load(file_name, const_path = nil)
        17. search_for_file(path_suffix)
        18. will_unload?(constant)
    14. Deprecation (in ActiveSupport)
    15. Deprecation::Assertions (in ActiveSupport)
      1. Public Instance Methods
        1. assert_deprecated(match = nil) { ... }
        2. assert_not_deprecated { ... }
    16. Duration (in ActiveSupport)
      1. Public Instance Methods
        1. + (other)
        2. - (other)
        3. ago(time = Time.now)
      2. from_now(time = Time.now)
        1. inspect
        2. since(time = Time.now)
        3. until(time = Time.now)
        4. Enumerable
      3. Public Instance Methods
        1. group_by(&block)
        2. sum(default = 0, &block)
        3. index_by
    17. Exception
      1. Public Instance Methods
        1. application_backtrace
        2. blame_file!(file)
        3. blamed_files
        4. copy_blame!(other)
        5. framework_backtrace
    18. FalseClass
      1. Public Instance Methods
        1. blank?
    19. File
      1. Public Instance Methods
        1. atomic_write(file_name, temp_dir = Dir.tmpdir)
    20. Hash
      1. Public Instance Methods
        1. blank?
    21. Hash::ClassMethods (in ActiveRecord::CoreExtensions)
      1. Public Class Methods
        1. from_xml(xml)
    22. Hash::Conversions (in ActiveSupport::CoreExtensions)
      1. Constants
      2. Public Instance Methods
        1. to_query
        2. to_xml(options={})
    23. Hash::Diff (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. diff(hash2)
    24. Hash::Except (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. except(*keys)
        2. except!(*keys)
    25. Hash::Keys (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. assert_valid_keys(*valid_keys)
        2. stringify_keys
        3. stringify_keys!
        4. symbolize_keys and to_options
        5. symbolize_keys! and to_options!
    26. Hash::ReverseMerge (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. reverse_merge(other_hash)
        2. reverse_merge!(other_hash) and reverse_update
    27. Hash::Slice (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. slice(*keys)
        2. slice!(*keys)
    28. HashWithIndifferentAccess
    29. Inflector::Inflections (in ActiveSupport)
      1. Public Instance Methods
        1. irregular(singular, plural)
        2. plural(rule, replacement)
        3. singular(rule, replacement)
        4. uncountable(*words)
    30. Integer::EvenOdd (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. even?
        2. multiple_of?(number)
        3. odd?
    31. Integer::Inflections (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. ordinalize
    32. JSON (in ActiveSupport)
      1. Constants
      2. Module Attributes
        1. unquote_hash_key_identifiers
      3. Class Methods
        1. decode(json)
        2. encode(object)
        3. reserved_word?(word)
        4. valid_identifier?(str)
    33. Kernel
      1. Public Instance Methods
        1. daemonize
        2. debugger
        3. enable_warnings {...}
        4. require_library_or_gem
        5. silence_stream(stream) { ... }
        6. silence_warnings { ... }
        7. suppress(*exception_classes) { ... }
    34. Logger
      1. Public Instance Methods
        1. around_debug(start_message, end_message) { ... }
        2. around_error, around_fatal, and around_info
        3. datetime_format
        4. datetime_format=(datetime_format)
        5. formatter
        6. silence(temporary_level = Logger::ERROR)
    35. Module
      1. Public Instance Methods
        1. alias_attribute(new_name, old_name)
        2. alias_method_chain(target, feature)
        3. as_load_path
        4. attr_accessor_with_default(sym, default = nil, &block)
        5. attr_internal
        6. attr_internal_accessor(*attrs)
        7. attr_internal_reader(*attrs)
        8. attr_internal_writer(*attrs)
        9. const_missing(class_id)
        10. delegate(*methods)
        11. deprecate(*method_names)
        12. included_in_classes
        13. local_constants
        14. mattr_accessor(*syms)
        15. mattr_reader(*syms)
        16. mattr_writer(*syms)
        17. parent
        18. parents
        19. unloadable(const_desc = self)
    36. MissingSourceFile
    37. Multibyte::Chars (in ActiveSupport)
      1. Class Methods
        1. handler=(klass)
      2. Public Instance Methods
        1. <=> (other)
        2. =~ (other)
        3. gsub(*a, &b)
        4. handler
        5. method_missing(m, *a, &b)
        6. respond_to?(method)
        7. split(*args)
        8. string
    38. NilClass
      1. Public Instance Methods
        1. blank?
        2. id
    39. Numeric
      1. Public Instance Methods
        1. blank?
    40. Numeric::Bytes (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. byte and bytes
        2. kilobyte and kilobytes
        3. megabyte and megabytes
        4. gigabyte and gigabytes
        5. terabyte and terabytes
        6. petabyte and petabytes
        7. exabyte and exabytes[2]
    41. Numeric::Time (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. ago and until
        2. day and days
        3. fortnight and fortnights
        4. from_now(time = Time.now) and since(time = Time.now)
        5. hour and hours
        6. minute and minutes
        7. month and months
        8. second and seconds
        9. week and weeks
        10. year and years
    42. Object
      1. Public Instance Methods
        1. `(command)
        2. acts_like?(duck)
        3. blank?
        4. copy_instance_variables_from(object, exclude = [])
        5. extended_by
        6. extend_with_included_modules_from(object)
        7. instance_exec(*arguments, &block)
        8. instance_values
        9. load(file, *extras)
        10. require(file, *extras)
        11. require_association(file_name)
        12. require_dependency(file_name)
        13. require_or_load(file_name)
        14. returning(value) { ... }
        15. unloadable(const_desc)
        16. with_options(options)
    43. OrderedHash (in ActiveSupport)
    44. OrderedOptions (in ActiveSupport)
    45. Proc
      1. Public Instance Methods
        1. bind(object) { ... }
    46. Range
      1. Constants
      2. Public Instance Methods
        1. to_formatted_s(format = :default)
    47. String
      1. Public Instance Methods
        1. at(position)
        2. blank?
        3. first(number)
        4. from(position)
        5. last(number)
        6. to(position)
        7. to_date
        8. to_datetime
        9. to_time(form = :utc)
    48. String::Inflections (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. camelize(first_letter = :upper)
        2. classify
        3. constantize
        4. dasherize
        5. demodulize
        6. foreign_key(separate_class_name_and_id_with_underscore = true)
        7. humanize
        8. pluralize
        9. singularize
        10. tableize
        11. titlecase
        12. titleize
        13. underscore
    49. String::Iterators (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. each_char { |char| ... }
    50. String::StartsEndsWith (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. starts_with?(prefix)
        2. ends_with?(suffix)
    51. String::Unicode (in ActiveSupport::CoreExtensions)
      1. Public Instance Methods
        1. chars
        2. is_utf8?(suffix)
    52. Symbol
      1. Public Instance Methods
        1. to_proc
    53. Test::Unit::Assertions
      1. Public Instance Methods
        1. assert_difference(expressions, difference = 1, message = nil, &block)
        2. assert_no_difference(expressions, message = nil, &block)
    54. Time::Calculations (in ActiveSupport::CoreExtensions)
      1. Class Methods
        1. days_in_month(month, year = nil)
        2. local_time(*args)
        3. time_with_datetime_fallback(utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0, usec=0)
        4. utc_time(*args)
      2. Public Instance Methods
        1. + (other)
        2. - (other)
        3. advance(options)
        4. ago(seconds)
        5. at_beginning of_day
        6. at_beginning of_month
        7. at_beginning of_week
        8. at_beginning of_year
        9. at_end of_day
        10. at_end of_month
        11. at_end of_week
        12. at_end of_year
        13. beginning of_day
        14. beginning of_month
        15. beginning_of_quarter
        16. beginning of_week
        17. beginning of_year
        18. change(options)
        19. end_of_day
        20. end_of_month
        21. last_month
        22. last_year
        23. monday
        24. months_ago(months)
        25. months_since(months)
        26. next_month
        27. next_year
        28. seconds_since_midnight
        29. since(seconds)
        30. tomorrow
        31. years_ago(years)
        32. years_since(years)
        33. yesterday
    55. Time::Conversions (in ActiveSupport::CoreExtensions)
      1. Constants
      2. Public Instance Methods
        1. to_date
        2. to_datetime
        3. to_formatted_s(format = :default)
        4. to_time
    56. TimeZone
      1. Constants
      2. Class Methods
        1. [] (arg)
        2. all
        3. create(name, offset)
        4. new(name)
        5. us_zones
      3. Public Instance Methods
        1. <=> (other)
        2. adjust(time)
        3. formatted_offset(colon = true)
        4. initialize(name, utc_offset)
        5. now
        6. to_s
        7. today
    57. TrueClass
      1. Public Instance Methods
        1. blank?
    58. References
  31. B. Rails Essentials
    1. Edge Rails
    2. Environmental Concerns
      1. Aliases
      2. Color
      3. Redgreen
    3. Essential Plugins
      1. ActiveRecord Defaults
      2. Debug View Helpers
      3. Exception Notification
      4. Exception Logger
      5. Has Finder
      6. Has Many Polymorphs
      7. Query Trace
      8. Spider Tester
      9. Other Plugins
    4. Screencasts
      1. PeepCode Screencasts
      2. Railcasts
    5. Subversion
      1. Rake Tasks for Subversion
    6. WorkingWithRails.com
      1. Using Subversion Hooks
  32. Afterword: What Is the Rails Way (To You)?