I was using Ryan Bates's source code for railscasts #141 in order to create a simple shopping cart. In one of the migrations, he lists
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
Here is the Product model:
class Product < ActiveRecord::Base
belongs_to :category
end
What is the t.belongs_to :category
line? Is that an alias for t.integer category_id
?