One such upcoming change is the integration of the ideas contained in plug-in that was
called Sexy Migrations. Sexy migrations are a new shorthand form of migration.
?– Note We covered migrations in detail in Chapter 3.
Previously, to create a table called products with several fields, you might do something
like the following:
create_table "products" do |t|
t.column "shop_id", :integer
t.column "creator_id", :integer
t.column "name", :string, :default => "Untitled"
t.column "value", :string, :default => "Untitled"
t.column "created_at", :datetime
t.column "updated_at", :datetime
end
With the new migrations shorthand, the preceding table-creation code can now be
expressed as follows:
create_table :products do |t|
t.integer :shop_id, :creator_id
t.string :name, :value, :default => "Untitled"
t.timestamps
end
Two Steps Forward, One Step Back
In addition to taking ideas that originally appeared in plug-ins to Active Record and integrating
them into it, the core team has also indicated that some features will be removed from
the core of Active Record and instead be available only as plug-ins.
Pages:
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443