method

validate_foreign_key

Importance_1
v7.1.3.4 - Show latest stable - 0 notes - Class: SchemaStatements
validate_foreign_key(from_table, to_table = nil, **options) public

Validates the given foreign key.

Validates the foreign key on accounts.branch_id.

validate_foreign_key :accounts, :branches

Validates the foreign key on accounts.owner_id.

validate_foreign_key :accounts, column: :owner_id

Validates the foreign key named special_fk_name on the accounts table.

validate_foreign_key :accounts, name: :special_fk_name

The options hash accepts the same keys as SchemaStatements#add_foreign_key.

Show source
Register or log in to add new notes.