Module: ActiveID::ConnectionPatches::ConnectionHandling

Defined in:
lib/active_id/connection_patches.rb

Instance Method Summary collapse

Instance Method Details

#establish_connection(*_args) ⇒ Object

rubocop:disable Metrics/MethodLength



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/active_id/connection_patches.rb', line 33

def establish_connection(*_args) # rubocop:disable Metrics/MethodLength
  super

  arca = ActiveRecord::ConnectionAdapters

  arca::Table.include(ColumnMethods)
  arca::TableDefinition.include(ColumnMethods)

  if defined? arca::MysqlAdapter
    arca::MysqlAdapter.prepend(Quoting)
  end

  if defined? arca::Mysql2Adapter
    arca::Mysql2Adapter.prepend(Quoting)
  end

  if defined? arca::SQLite3Adapter
    arca::SQLite3Adapter.prepend(Quoting)
  end

  if defined? arca::PostgreSQLAdapter
    arca::PostgreSQLAdapter.prepend(PostgreSQLQuoting)
  end
end