references(*args)
public

Adds a reference. Optionally adds a type column, if :polymorphic option is provided. references and belongs_to are acceptable. The reference column will be an integer by default, the :type option can be used to specify a different type. A foreign key will be created if a foreign_key option is passed.

t.references(:user)
t.references(:user, type: "string")
t.belongs_to(:supplier, polymorphic: true)

See SchemaStatements#add_reference

1Note

See column

mikael ยท Feb 17, 20092 thanks

See the end part of the docs on column for example uses.