Sha256: c90ba6fe7d9899aa3c4d45eb4d25e525aac2af91957965113e5c1d507ace9d3d

Contents?: true

Size: 884 Bytes

Versions: 5

Compression:

Stored size: 884 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)
      printf "ORM: #{Doozer::Configs.orm()} initialized...\n"
      # printf "ORM: logging initialized"
      ActiveRecord::Base.logger = Doozer::Configs.logger
    end
    
    def self.after_request
      ActiveRecord::Base.clear_active_connections!
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
doozer-0.2.6 lib/doozer/orm/active_record.rb
doozer-0.2.5 lib/doozer/orm/active_record.rb
doozer-0.2.2 lib/doozer/orm/active_record.rb
doozer-0.2.1 lib/doozer/orm/active_record.rb
doozer-0.2.0 lib/doozer/orm/active_record.rb