Module: BulkRecord::Base::ConnectionHandling

Included in:
BulkRecord::Base
Defined in:
lib/bulk_record.rb

Instance Method Summary collapse

Instance Method Details

#establish_connection(env) ⇒ Object



35
36
37
38
# File 'lib/bulk_record.rb', line 35

def establish_connection(env)
  conf = self.configurations[env]
  self.connection = mysql2_connection(conf)
end

#mysql2_connection(config) ⇒ Object



40
41
42
43
# File 'lib/bulk_record.rb', line 40

def mysql2_connection(config)
  config[:username] = 'root' if config[:username].nil?
  return Mysql2::Client.new(config.symbolize_keys)
end