Class: ActiveRecord::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/mysql2_downcase_adapter.rb

Class Method Summary collapse

Class Method Details

.mysql2_downcase_connection(config) ⇒ Object

Establishes a connection to the database that’s used by all Active Record objects.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/active_record/connection_adapters/mysql2_downcase_adapter.rb', line 10

def self.mysql2_downcase_connection(config)
  config[:username] = 'root' if config[:username].nil?

  if Mysql2::Client.const_defined? :FOUND_ROWS
    config[:flags] = Mysql2::Client::FOUND_ROWS
  end

  client = Mysql2::Client.new(config.symbolize_keys)
  options = [config[:host], config[:username], config[:password], config[:database], config[:port], config[:socket], 0]
  ConnectionAdapters::Mysql2DowncaseAdapter.new(client, logger, options, config)
  # ActiveRecord::Base.mysql2_connection(config)
end