t.belongs_to dans la migration

J'ai été à l'aide de Ryan Bates le code source pour railscasts #141, afin de créer un simple panier. Dans l'un des migrations, il énumère

class CreateProducts < ActiveRecord::Migration
  def self.up
    create_table :products do |t|
      t.belongs_to :category
      t.string :name
      t.decimal :price
      t.text :description
      t.timestamps
    end
  end

  def self.down
    drop_table :products
  end
end

Ici est le modèle de Produit:

class Product < ActiveRecord::Base
 belongs_to :category
end

Quel est le t.belongs_to :category ligne? C'est qu'un alias pour t.integer category_id?

InformationsquelleAutor Tyler DeWitt | 2012-02-27