Sha256: 25edac1e37e6265331f887a01c66f8c83f8fb82dd4e115b352d1c1f40709b313

Contents?: true

Size: 833 Bytes

Versions: 7

Compression:

Stored size: 833 Bytes

Contents

require 'active_record'
module Doozer
  module ORM
    def self.load
      db_config = Doozer::Configs.db()
      #ActiveRecord::Base.allow_concurrency = true
        config = {
          :adapter  => db_config["adapter"],
          :host     => db_config["host"],
          :username => db_config["username"],
          :password => db_config["password"],
          :database => db_config["database"]
        }
      config[:pool] = db_config["pool"] if db_config["pool"]
      config[:reconnect] = db_config["reconnect"] if db_config["reconnect"]
      
      ActiveRecord::Base.establish_connection(config)
      puts "=> #{Doozer::Configs.orm()} initialized"
      ActiveRecord::Base.logger = Doozer::Configs.logger
    end
    
    def self.after_request
      ActiveRecord::Base.clear_active_connections!
    end
    
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
doozer-0.4.4 lib/doozer/orm/active_record.rb
doozer-0.4.3 lib/doozer/orm/active_record.rb
doozer-0.4.2 lib/doozer/orm/active_record.rb
doozer-0.4.1 lib/doozer/orm/active_record.rb
doozer-0.4.0 lib/doozer/orm/active_record.rb
doozer-0.3.1 lib/doozer/orm/active_record.rb
doozer-0.3.0 lib/doozer/orm/active_record.rb