Class: ActiveRecord::ConnectionAdapters::ConnectionManagement

Inherits:
Object
  • Object
show all
Defined in:
activerecord/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



470
471
472
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 470

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



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

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