Module: SchemaPlus::Core::ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation

Defined in:
lib/schema_plus/foreign_keys/active_record/connection_adapters/abstract/schema_creation.rb

Instance Method Summary collapse

Instance Method Details

#foreign_key_in_create(from_table, to_table, options) ⇒ Object

The TableDefinition::foreign_keys attribute contains ForeignKeyDefinitions instead of

to_table, options

tuples when using schema_plus_foreign_keys.

This function happily accepts to_table and options arguments anyway, so we just ignore all arguments and treat to_table as the ForeignKeyDefinition and convert it to SQL directly.



19
20
21
# File 'lib/schema_plus/foreign_keys/active_record/connection_adapters/abstract/schema_creation.rb', line 19

def foreign_key_in_create(from_table, to_table, options)
  accept to_table # This is the ForeignKeyDefinition
end

#visit_ForeignKeyDefinition(o) ⇒ Object



8
9
10
11
12
# File 'lib/schema_plus/foreign_keys/active_record/connection_adapters/abstract/schema_creation.rb', line 8

def visit_ForeignKeyDefinition(o)
  # schema_plus_foreign_keys already implements a superior
  # conversion of ForeignKeyDefinitions to SQL
  o.to_sql
end