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.



466
467
468
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 466

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



470
471
472
473
474
475
476
477
478
479
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 470

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