Module: ActiveRecord::CreatingForeignKeys::ConnectionSpecification::Resolver

Defined in:
lib/activerecord/creating_foreign_keys/connection_specification/resolver.rb

Instance Method Summary collapse

Instance Method Details

#spec(config) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/activerecord/creating_foreign_keys/connection_specification/resolver.rb', line 7

def spec(config)
  connection_specification = super(config)

  if connection_specification.config[:adapter] == "mysql2"
    require "activerecord/creating_foreign_keys/schema_creation"
    require "activerecord/creating_foreign_keys/schema_statements"

    ActiveRecord::ConnectionAdapters::Mysql2Adapter::SchemaCreation.prepend(ActiveRecord::CreatingForeignKeys::SchemaCreation)
    ActiveRecord::ConnectionAdapters::Mysql2Adapter.prepend(ActiveRecord::CreatingForeignKeys::SchemaStatements)
  end

  connection_specification
end