Foreword to the Previous Edition by David Heinemeier Hansson
Foreword to the Previous Edition by Yehuda Katz
Chapter 1 Rails Environments and Configuration
1.2 Startup and Application Settings
1.2.3 Additional Configuration
1.2.4 Spring Application Preloader
1.3.1 Automatic Class Reloading
1.3.7 Pending Migrations Error Page
1.7 Configuring Application Secrets
2.1 The Two Purposes of Routing
2.2.2 Constraining Request Methods
2.2.5 Spotlight on the :id
Field
2.2.9 Routes as Rack Endpoints
2.2.11 Segment Key Constraints
2.4.2 name_path
versus name_url
2.4.3 What to Name Your Routes
2.4.5 A Little More Sugar with Your Sugar?
Chapter 3 REST, Resources, and Rails
3.1 REST in a Rather Small Nutshell
3.2 Resources and Representations
3.4.1 REST Resources and Rails
3.4.2 From Named Routes to REST Support
3.5 The Standard RESTful Controller Actions
3.5.2 Singular and Plural RESTful Routes
3.5.3 The Special Pairs: new/create
and edit/update
3.5.4 The PATCH and DELETE Cheat
3.5.5 Limiting Routes Generated
3.7.1 RESTful Controller Mappings
3.9 RESTful Route Customizations
3.9.4 Mapping to a Different Controller
3.9.5 Routes for New Resources
3.9.6 Considerations for Extra Routes
3.10 Controller-Only Resources
3.11 Different Representations of Resources
3.12 The RESTful Rails Action Set
Chapter 4 Working with Controllers
4.1.1 Configuring Your Middleware Stack
4.2 Action Dispatch: Where It All Begins
4.2.2 Getting Intimate with the Dispatcher
4.3.3 Rendering Another Action’s Template
4.3.4 Rendering a Different Template Altogether
4.3.5 Rendering a Partial Template
4.3.6 Rendering Inline Template Code
4.3.8 Rendering Other Types of Structured Data
4.6 Controller/View Communication
4.7.1 Action Callback Inheritance
4.7.3 Action Callback Chain Ordering
4.7.5 Action Callback Chain Skipping
4.7.6 Action Callback Conditions
4.7.7 Action Callback Chain Halting
4.8.2 View Streaming via render stream: true
4.8.3 send_data(data, options = {})
4.8.4 send_file(path, options = {})
Chapter 5 Working with Active Record
5.2.1 Relationship Declarations
5.2.2 Convention over Configuration
5.3.1 Default Attribute Values
5.4 CRUD: Create, Read, Update, and Delete
5.4.1 Creating New Active Record Instances
5.4.2 Reading Active Record Objects
5.4.3 Reading and Writing Attributes
5.4.4 Accessing and Manipulating Attributes before They Are Typecast
5.4.11 Updating a Particular Instance
5.4.12 Updating Specific Attributes
5.4.16 Deleting and Destroying
5.6.3 limit(number)
and offset(number)
5.6.7 extending(*modules, &block)
5.6.10 includes(*associations)
5.7 Connections to Multiple Databases in Different Models
5.8 Using the Database Connection Directly
5.8.1 The DatabaseStatements
Module
5.8.2 Other Connection Methods
5.9 Other Configuration Options
Chapter 6 Active Record Migrations
6.1.5 create_table(name, options, &block)
6.1.6 change_table(table_name, &block)
6.1.10 Command-Line Column Declarations
6.5 Database-Related Rake Tasks
Chapter 7 Active Record Associations
7.2.1 Adding Associated Objects to a Collection
7.2.2 Association Collection Methods
7.3 The belongs_to
Association
7.3.1 Reloading the Association
7.3.2 Building and Creating Related Objects via the Association
7.5 Many-to-Many Relationships
7.5.3 has_many :through
Options
7.5.4 Unique Association Objects
7.7 Working with Unsaved Objects and Associations
8.2 The Simple Declarative Validations
8.2.4 validates_confirmation_of
8.2.7 validates_inclusion_of
and validates_exclusion_of
8.2.9 validates_numericality_of
8.2.11 validates_uniqueness_of
8.3.1 :allow_blank
and :allow_nil
8.4.1 Usage and Considerations
8.6 Custom Validation Techniques
8.6.1 Add Custom Validation Macros to Your Application
8.6.2 Create a Custom Validator Class
8.6.3 Add a validate
Method to Your Model
8.8 Working with the Errors Hash
8.9 Testing Validations with Shoulda
Chapter 9 Advanced Active Record
9.2.3 Matched before/after
Callbacks
9.2.6 Special Callbacks: after_initialize
and after_find
9.3.1 average(column_name, *options)
9.3.2 count(column_name, *options)
9.3.4 maximum(column_name, *options)
9.3.5 minimum(column_name, *options)
9.3.7 sum(column_name, *options)
9.4 Single-Table Inheritance (STI)
9.4.1 Mapping Inheritance to the Database
9.5 Abstract Base Model Classes
9.6 Polymorphic has_many
Relationships
9.6.1 In the Case of Models with Comments
9.9 Modules for Reusing Common Behavior
9.9.1 A Review of Class Scope and Contexts
9.10 Modifying Active Record Classes at Runtime
9.10.2 Ruby and Domain-Specific Languages
9.13.1 Schemaless Data with hstore
10.1.1 Template Filename Conventions
10.1.6 Standard Instance Variables
10.1.7 Displaying flash
Messages
10.2.4 Passing Variables to Partials
11.1.1 Reporting Validation Errors
11.1.2 Automatic Form Creation
11.1.3 Customizing the Way Validation Errors Are Highlighted
11.7.1 The Date and Time Selection Helpers
11.7.2 The Individual Date and Time Select Helpers
11.7.3 Common Options for Date Selection Helpers
11.7.4 distance_in_time
Methods with Complex Descriptive Names
11.7.5 time_tag(date_or_time, *args, &block)
11.9.1 Creating Forms for Models
11.9.2 How Form Helpers Get Their Values
11.9.3 Integrating Additional Objects in One Form
11.9.4 Customized Form Builders
11.10.2 Check Box/Radio Helpers
11.20 TranslationHelper
and the I18n API
11.20.2 TranslationHelper Methods
11.20.4 Setting and Passing the Locale
11.20.5 Setting Locale from Client-Supplied Information
11.20.6 Internationalizing Your Application
11.20.7 Organization of Locale Files
11.20.8 Looking Up Translations
11.20.9 How to Store Your Custom Translations
11.20.10 Overview of Other Built-In Methods That Provide I18n Support
11.22 Writing Your Own View Helpers
11.22.1 Small Optimizations: The Title Helper
11.22.2 Encapsulating View Logic: The photo_for
Helper
11.22.3 Smart View: The breadcrumbs
Helper
11.23 Wrapping and Generalizing Partials
12.5.2 Escaping/Unescaping HTML
12.5.3 Escaping the First Character of a Line
12.6.3 list_of(enum, opts = {}) { |item| ... }
13.1 What to Store in the Session
13.3.1 Active Record Session Store
13.3.2 Memcached Session Storage
13.3.3 The Controversial CookieStore
13.3.4 Cleaning Up Old Sessions
13.4.1 Reading and Writing Cookies
Chapter 14 Authentication and Authorization
14.2.3 Setting Up the Controllers
14.2.4 Controller, Limiting Access to Actions
15.3 SSL (Secure Sockets Layer)
15.4 Model Mass-Assignment Attributes Protection
15.5.1 What Is an SQL Injection?
15.6 Cross-Site Scripting (XSS)
15.6.3 Input versus Output Escaping
15.7 XSRF (Cross-Site Request Forgery)
15.7.1 Restricting HTTP Method for Actions with Side Effects
15.7.2 Require Security Token for Protected Requests
15.7.3 Client-Side Security Token Handling
16.2.1 Preparing Outbound Email Messages
16.3.1 Handling Incoming Attachments
Chapter 17 Caching and Performance
17.1.6 Expiration of Cached Content
17.1.7 Automatic Cache Expiry with Sweepers
17.1.8 Avoiding Extra Database Activity
17.2.1 Eliminating Extra Database Lookups
17.2.2 Initializing New Caches
17.3.1 expires_in(seconds, options = )
Chapter 18 Background Processing
19.1.3 jQuery UJS Custom Events
20.4 Organization: Where Does Everything Go?
20.8.2 Getting the URL of an Asset File
20.8.3 Built-In SASS Asset Path Helpers
21.2.2 let(:name) { expression }
21.2.3 let!(:name) { expression }
21.2.8 expect(...).to
/ expect(...).not_to
21.4 Custom Expectation Matchers
21.7.4 Partial Mocking and Stubbing
22.1.1 Customizing to_xml
Output
22.1.2 Associations and to_xml
22.1.4 Dynamic Runtime Attributes
22.3.1 Turning XML into Hashes
Appendix A Active Model API Reference
A.1.1 active_model/attribute_methods.rb
A.2.1 active_model/callbacks.rb
A.3.1 active_model/conversion.rb
A.12.1 active_model/serialization.rb
A.13.1 active_model/serializers/json.rb
A.14.1 active_model/serializers/xml.rb
A.15.1 active_model/translation.rb
A.16.1 active_model/validations
A.16.2 active_model/validations/absence
A.16.3 active_model/validations/acceptance
A.16.4 active_model/validations/callbacks
A.16.5 active_model/validations/confirmation
A.16.6 active_model/validations/exclusion
A.16.7 active_model/validations/format
A.16.8 active_model/validations/inclusion
A.16.9 active_model/validations/length
A.16.10 active_model/validations/numericality
A.16.11 active_model/validations/presence
A.16.12 active_model/validations/validates
A.16.13 active_model/validations/with
A.17.1 active_model/validator.rb
Appendix B Active Support API Reference
B.1.1 active_support/core_ext/array/access
B.1.2 active_support/core_ext/array/conversions
B.1.3 active_support/core_ext/array/extract_options
B.1.4 active_support/core_ext/array/grouping
B.1.5 active_support/core_ext/array/prepend_and_append
B.1.6 active_support/core_ext/array/wrap
B.1.7 active_support/core_ext/object/blank
B.1.8 active_support/core_ext/object/to_param
B.2 ActiveSupport::BacktraceCleaner
B.2.1 active_support/backtrace_cleaner
B.4 ActiveSupport::Benchmarkable
B.4.1 active_support/benchmarkable
B.5.1 active_support/core_ext/big_decimal/conversions
B.5.2 active_support/json/encoding
B.6 ActiveSupport::Cache::Store
B.7 ActiveSupport::CachingKeyGenerator
B.7.1 active_support/key_generator
B.8.1 active_support/callbacks
B.9.1 active_support/core_ext/class/attribute
B.9.2 active_support/core_ext/class/attribute_accessors
B.9.3 active_support/core_ext/class/attribute_accessors
B.9.4 active_support/core_ext/class/delegating_attributes
B.9.5 active_support/core_ext/class/subclasses
B.11 ActiveSupport::Concurrency
B.11.1 ActiveSupport::Concurrency::Latch
B.12 ActiveSupport::Configurable
B.12.1 active_support/configurable
B.13.1 active_support/core_ext/date/acts_like
B.13.2 active_support/core_ext/date/calculations
B.13.3 active_support/core_ext/date/conversions
B.13.4 active_support/core_ext/date/zones
B.13.5 active_support/json/encoding
B.14.1 active_support/core_ext/date_time/acts_like
B.14.2 active_support/core_ext/date_time/calculations
B.14.3 active_support/core_ext/date_time/conversions
B.14.4 active_support/core_ext/date_time/zones
B.14.5 active_support/json/encoding
B.15 ActiveSupport::Dependencies
B.15.1 active_support/dependencies
B.15.2 active_support/dependencies/autoload
B.16 ActiveSupport::Deprecation
B.16.1 active_support/deprecation
B.17 ActiveSupport::DescendantsTracker
B.17.1 active_support/descendants_tracker
B.18.1 active_support/duration
B.19.1 active_support/core_ext/enumerable
B.19.2 active_support/json/encoding
B.20.1 active_support/core_ext/string/output_safety
B.21.1 active_support/core_ext/object/blank
B.21.2 active_support/json/encoding
B.22.1 active_support/core_ext/file/atomic
B.23.1 active_support/core_ext/hash/compact
B.23.2 active_support/core_ext/hash/conversions
B.23.3 active_support/core_ext/hash/deep_merge
B.23.4 active_support/core_ext/hash/except
B.23.5 active_support/core_ext/hash/indifferent_access
B.23.6 active_support/core_ext/hash/keys
B.23.7 active_support/core_ext/hash/reverse_merge
B.23.8 active_support/core_ext/hash/slice
B.23.9 active_support/core_ext/object/to_param
B.23.10 active_support/core_ext/object/to_query
B.23.11 active_support/json/encoding
B.23.12 active_support/core_ext/object/blank
B.25 ActiveSupport::HashWithIndifferentAccess
B.25.1 active_support/hash_with_indifferent_access
B.26 ActiveSupport::Inflector::Inflections
B.26.1 active_support/inflector/inflections
B.26.2 active_support/inflector/transliterate
B.27.1 active_support/core_ext/integer/inflections
B.27.2 active_support/core_ext/integer/multiple
B.28.1 active_support/json/decoding
B.28.2 active_support/json/encoding
B.29.1 active_support/core_ext/kernel/agnostics
B.29.2 active_support/core_ext/kernel/debugger
B.29.3 active_support/core_ext/kernel/reporting
B.29.4 active_support/core_ext/kernel/singleton_class
B.30 ActiveSupport::KeyGenerator
B.30.1 active_support/key_generator
B.31.2 active_support/logger_silence
B.32 ActiveSupport::MessageEncryptor
B.32.1 active_support/message_encryptor
B.33 ActiveSupport::MessageVerifier
B.33.1 active_support/message_verifier
B.34.1 active_support/core_ext/module/aliasing
B.34.2 active_support/core_ext/module/anonymous
B.34.3 active_support/core_ext/module/attr_internal
B.34.4 active_support/core_ext/module/attribute_accessors
B.34.5 active_support/core_ext/module/concerning
B.34.6 active_support/core_ext/module/delegation
B.34.7 active_support/core_ext/module/deprecation
B.34.8 active_support/core_ext/module/introspection
B.34.9 active_support/core_ext/module/qualified_const
B.34.10 active_support/core_ext/module/reachable
B.34.11 active_support/core_ext/module/remove_method
B.34.12 active_support/dependencies
B.35 ActiveSupport::Multibyte::Chars
B.35.1 active_support/multibyte/chars
B.35.2 active_support/multibyte/unicode
B.36.1 active_support/core_ext/object/blank
B.36.2 active_support/json/encoding
B.37 ActiveSupport::Notifications
B.37.1 active_support/core_ext/object/blank
B.37.2 active_support/json/encoding
B.37.3 active_support/core_ext/numeric/bytes
B.37.4 active_support/core_ext/numeric/conversions
B.37.5 active_support/core_ext/numeric/time
B.38.1 active_support/core_ext/object/acts_like
B.38.2 active_support/core_ext/object/blank
B.38.3 active_support/core_ext/object/deep_dup
B.38.4 active_support/core_ext/object/duplicable
B.38.5 active_support/core_ext/object/inclusion
B.38.6 active_support/core_ext/object/instance_variables
B.38.7 active_support/core_ext/object/json
B.38.8 active_support/core_ext/object/to_param
B.38.9 active_support/core_ext/object/to_query
B.38.10 active_support/core_ext/object/try
B.38.11 active_support/core_ext/object/with_options
B.38.12 active_support/dependencies
B.39 ActiveSupport::OrderedHash
B.39.1 active_support/ordered_hash
B.40 ActiveSupport::OrderedOptions
B.40.1 active_support/ordered_options
B.41 ActiveSupport::PerThreadRegistry
B.41.1 active_support/per_thread_registry
B.42 ActiveSupport::ProxyObject
B.42.1 active_support/proxy_object
B.44.1 active_support/core_ext/range/conversions
B.44.2 active_support/core_ext/range/each
B.44.3 active_support/core_ext/range/include_range
B.44.4 active_support/core_ext/range/overlaps
B.44.5 active_support/core_ext/enumerable
B.45.1 active_support/core_ext/regexp
B.45.2 active_support/json/encoding
B.46.1 active_support/rescuable
B.47.1 active_support/json/encoding
B.47.2 active_support/core_ext/object/blank
B.47.3 active_support/core_ext/string/access
B.47.4 active_support/core_ext/string/behavior
B.47.5 active_support/core_ext/string/conversions
B.47.6 active_support/core_ext/string/exclude
B.47.7 active_support/core_ext/string/filters
B.47.8 active_support/core_ext/string/indent
B.47.9 active_support/core_ext/string/inflections
B.47.10 active_support/core_ext/string/inquiry
B.47.11 active_support/core_ext/string/multibyte
B.47.12 active_support/core_ext/string/output_safety
B.47.13 active_support/core_ext/string/starts_ends_with
B.47.14 active_support/core_ext/string/strip
B.47.15 active_support/core_ext/string/in_time_zone
B.48 ActiveSupport::StringInquirer
B.49.1 active_support/core_ext/struct
B.50 ActiveSupport::Subscriber
B.51.1 active_support/json/encoding
B.52 ActiveSupport::TaggedLogging
B.52.1 active_support/tagged_logger
B.53.1 active_support/test_case
B.54 ActiveSupport::Testing::Assertions
B.54.1 active_support/testing/assertions
B.54.2 active_support/testing/time_helpers
B.55.1 active_support/core_ext/thread
B.56.1 active_support/json/encoding
B.56.2 active_support/core_ext/time/acts_like
B.56.3 active_support/core_ext/time/calculations
B.56.4 active_support/core_ext/time/conversions
B.56.5 active_support/core_ext/time/marshal
B.56.6 active_support/core_ext/time/zones
B.57 ActiveSupport::TimeWithZone
B.58.1 active_support/values/time_zone
B.59.1 active_support/core_ext/object/blank
B.59.2 active_support/json/encoding
3.128.226.121