rosa-build/lib/close_ar_connections_middle...

13 lines
236 B
Ruby

# "Coffee's for closers"
class CloseArConnectionsMiddleware
def initialize(app)
@app = app
end
def call(env)
@app.call(env)
ensure
ActiveRecord::Base.clear_active_connections! unless env.key?('rack.test')
end
end