method
foreign_key_exists?
v8.1.1 -
Show latest stable
- Class:
ActiveRecord::ConnectionAdapters::Table
foreign_key_exists?(*args, **options)public
Checks to see if a foreign key exists.
t.foreign_key(:authors) unless t.foreign_key_exists?(:authors)
See {connection.foreign_key_exists?}[rdoc-ref:SchemaStatements#foreign_key_exists?]