Class: ActiveRecord::ConnectionAdapters::ConnectionManagement

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

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ConnectionManagement

Returns a new instance of ConnectionManagement.



356
357
358
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 356

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



360
361
362
363
364
365
366
367
368
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 360

def call(env)
  @app.call(env)
ensure
  # Don't return connection (and peform implicit rollback) if
  # this request is a part of integration test
  unless env.key?("rack.test")
    ActiveRecord::Base.clear_active_connections!
  end
end