Class: ActiveRecord::ConnectionAdapters::ConnectionManagement

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/abstract/connection_pool.rb

Defined Under Namespace

Classes: Proxy

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ConnectionManagement

Returns a new instance of ConnectionManagement.



472
473
474
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 472

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



476
477
478
479
480
481
482
483
484
485
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 476

def call(env)
  testing = env.key?('rack.test')

  status, headers, body = @app.call(env)

  [status, headers, Proxy.new(body, testing)]
rescue
  ActiveRecord::Base.clear_active_connections! unless testing
  raise
end