method
validate_foreign_key
rails latest stable - Class:
ActiveRecord::ConnectionAdapters::PostgreSQL::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.