対FOREIGN_KEYこれは、私は違いがW/Bコードのこれらline.Bothラインはテーブル間の基準を達成するために正常に動作しているされているもの混乱しています私のコードRailsのアクティブレコード:参照
class CreatePosts < ActiveRecord::Migration[5.1]
def change
create_table :posts, id: :uuid do |t|
t.string :name
t.references :user, type: :uuid
t.references :user, type: :uuid, foreign_key: true
t.timestamps
end
end
end
です。
t.references :user, type: :uuid
t.references :user, type: :uuid, foreign_key: true #what this line is doing
かない FOREIGN_KEY を使用するとき、誰が私を説明することができます。
上記のコードでは、これらの
t.references :makers, foreign_key: { to_table: :office }
を検索FOREIGN_KEYが真でない間、私は似たものを見つけます。いくつかのテーブルを参照しています。なぜそうなの?