class ActiveRecord::Rack::ConnectionManagement

Public Class Methods

new(app) click to toggle source
# File lib/active_record/rack/connection_management.rb, line 26
def initialize(app)
        @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/active_record/rack/connection_management.rb, line 30
def call(env)
        response = @app.call(env)
        
        response[2] = ::Rack::BodyProxy.new(response[2]) do
                ActiveRecord::Base.clear_active_connections!
        end
        
        return response
rescue Exception
        ActiveRecord::Base.clear_active_connections!
        raise
end