Rails ガイドを読んでいたところ、次のコード行が見つかりました。
class CreateComments < ActiveRecord::Migration
def change
create_table :comments do |t|
t.string :commenter
t.text :body
t.references :post
t.timestamps
end
add_index :comments, :post_id
end
end
Michael Hartl の本 Rails Tutorial も読みましたが、上記のコードで使用されている「t.references」については何も見つかりませんでした。それは何をするためのものか?マイケルの本では、私はモデルで has_many と belongs_to リレーションを使用し、マイグレーションでは何も使用しませんでした (イベント t.belongs_to ではありません)。