Class: Adhearsion::Initializer::RailsInitializer

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

Class Method Summary collapse

Class Method Details

.startObject



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

def start
  ahn_config       = Adhearsion::AHN_CONFIG
  self.config      = ahn_config.rails
  self.rails_root  = config.rails_root 
  self.environment = config.environment
  raise "You cannot enable the database and Rails at the same time!" if ahn_config.database_enabled?
  raise "Error loading Rails environment in #{rails_root.inspect}. "  +
        "It's not a directory!" unless File.directory?(rails_root)
  load_rails
  if defined? ActiveRecord
    # You may need to uncomment the following line for older versions of ActiveRecord
    # ActiveRecord::Base.allow_concurrency = true
    Events.register_callback([:asterisk, :before_call]) do
      ActiveRecord::Base.verify_active_connections!
    end
  end
end