14.6 DebuggingHints ........................... 244
14.7 What�fsNext .............................. 246
15 Active Support 247
15.1 GenerallyAvailableExtensions . . . . . . . . . . . . . . . . . . 247
15.2 EnumerationsandArrays ..................... 248
15.3 StringExtensions .......................... 249
15.4 ExtensionstoNumbers ....................... 251
15.5 TimeandDateExtensions ..................... 252
15.6 AnExtensiontoRubySymbols .................. 254
15.7 with_options ............................. 255
15.8 UnicodeSupport ........................... 256
16 Migrations 262
16.1 Creating andRunningMigrations . . . . . . . . . . . . . . . . . 263
16.2 Anatomy of aMigration ....................... 265
16.3 ManagingTables ........................... 269
16.4 DataMigrations ........................... 274
16.5 AdvancedMigrations ........................ 277
16.6 WhenMigrationsGoBad ...................... 279
16.7 SchemaManipulationOutsideMigrations . . . . . . . . . . . . 280
16.8 ManagingMigrations ........................ 281
Report erratum
Prepared exclusively for Jordan A. Fowler
CONTENTS
17 Active Record: The Basics
283
17.1 TablesandClasses ......................... 284
17.2 ColumnsandAttributes ...................... 284
17.3 PrimaryKeysandIDs ........................ 288
17.4 Connecting totheDatabase .................... 290
17.5 CRUD.Create,Read,Update,Delete. . . . . . . . . . . . . . . 295
17.6 AggregationandStructuredData . . . . . . . . . . . . . . . . . 313
17.7 Miscellany............................... 320
18 Active Record: Relationships between Tables 323
18.1 CreatingForeignKeys ........................ 324
18.2 SpecifyingRelationshipsinModels . . . . . . . . . . . . . . . . 326
18.3 belongs_toandhas_xxxDeclarations. . . . . . . . . . . . . . . 328
18.4 Joining toMultipleTables ..................... 343
18.5 Self-referentialJoins ........................ 353
18.6 ActsAs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
18.7 WhenThingsGetSaved....................... 358
18.8 PreloadingChildRows ....................... 360
18.9 Counters ............................... 361
19 Active Record: Object Life Cycle 363
19.1 Validation ............................... 363
19.2 Callbacks ............................... 373
Agile Web Development with Rails
Start from the beginning
