Class: Adhearsion::Initializer::DatabaseInitializer

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/initializer/database.rb

Class Method Summary collapse

Class Method Details

.startObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/adhearsion/initializer/database.rb', line 10

def start
  require_dependencies
  require_models
  @@config = Adhearsion::AHN_CONFIG.database
  # You may need to uncomment the following line for older versions of ActiveRecord
  # ActiveRecord::Base.allow_concurrency = true
  establish_connection
  ActiveRecord::Base.logger =
    @@config.connection_options.has_key?(:logger) ?
      @@config.connection_options[:logger] :
      ahn_log.db
  create_call_hook_for_connection_cleanup
end

.stopObject



24
25
26
# File 'lib/adhearsion/initializer/database.rb', line 24

def stop
  ActiveRecord::Base.remove_connection
end