From 74a0a14870df669f707ecf223cf2565a26a40b22 Mon Sep 17 00:00:00 2001 From: Nat Budin Date: Wed, 18 Apr 2012 11:40:20 -0400 Subject: [PATCH] Clear active connections after each request --- lib/sinatra/activerecord.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/sinatra/activerecord.rb b/lib/sinatra/activerecord.rb index af8a4d5..16522f5 100644 --- a/lib/sinatra/activerecord.rb +++ b/lib/sinatra/activerecord.rb @@ -55,6 +55,10 @@ def self.registered(app) app.set :activerecord_logger, Logger.new(STDOUT) app.database # force connection app.helpers ActiveRecordHelper + + app.after do + ActiveRecord::Base.clear_active_connections! + end end end