Class: ActiveRecord::Rack::ConnectionManagement
- Inherits:
-
Object
- Object
- ActiveRecord::Rack::ConnectionManagement
- Defined in:
- lib/active_record/rack/connection_management.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ConnectionManagement
constructor
A new instance of ConnectionManagement.
Constructor Details
#initialize(app) ⇒ ConnectionManagement
Returns a new instance of ConnectionManagement.
26 27 28 |
# File 'lib/active_record/rack/connection_management.rb', line 26 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# 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 |