aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2016-06-29 09:56:19 -0400
committerSean Griffin <sean@seantheprogrammer.com>2016-06-29 09:56:19 -0400
commit160cc331796ebfbcd6da83e96f391ab5732832b6 (patch)
treee15254d038a97569bcbc228fa02609b3811d28d4 /activerecord
parent4565de0da14a4b3d75e8b1a652fcb6dcd947c451 (diff)
downloadrails-160cc331796ebfbcd6da83e96f391ab5732832b6.tar.gz
rails-160cc331796ebfbcd6da83e96f391ab5732832b6.tar.bz2
rails-160cc331796ebfbcd6da83e96f391ab5732832b6.zip
Don't attempt to clear active connections unless we'ere connected
Right now with this middleware we are likely always connected, but I'm hoping to change that soon. This is an easy change to pull out on its own.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/query_cache.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/query_cache.rb b/activerecord/lib/active_record/query_cache.rb
index fa3e306b3e..387dd8e9bd 100644
--- a/activerecord/lib/active_record/query_cache.rb
+++ b/activerecord/lib/active_record/query_cache.rb
@@ -40,7 +40,7 @@ module ActiveRecord
executor.register_hook(self)
executor.to_complete do
- unless ActiveRecord::Base.connection.transaction_open?
+ unless ActiveRecord::Base.connected? && ActiveRecord::Base.connection.transaction_open?
ActiveRecord::Base.clear_active_connections!
end
end