Module: IB::DB

Defined in:
lib/ib/db.rb

Class Method Summary collapse

Class Method Details

.connect(config) ⇒ Object

Use this method to establish DB connection unless you’re running on Rails



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ib/db.rb', line 13

def self.connect config

  # Use ib prefix for all DB tables
  ActiveRecord::Base.table_name_prefix = "ib_"

  # Get rid of nasty conversion issues
  ActiveRecord::Base.default_timezone = :utc
  Time.zone = 'UTC'

  ActiveRecord::Base.establish_connection(config)
  #ActiveRecord.colorize_logging = false
end

.logger=(logger) ⇒ Object



8
9
10
# File 'lib/ib/db.rb', line 8

def self.logger= logger
  ActiveRecord::Base.logger = logger
end