From 56ecff58bf3850c504d199faf79721032bc85cfa Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Mon, 26 Jul 2010 00:10:49 -0700 Subject: [PATCH] don't attempt a query unless a connection exists to do it on --- lib/active_record/connection_adapters/mysql2_adapter.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/active_record/connection_adapters/mysql2_adapter.rb b/lib/active_record/connection_adapters/mysql2_adapter.rb index d227ce8..dc5b890 100644 --- a/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -231,6 +231,7 @@ module ActiveRecord # CONNECTION MANAGEMENT ==================================== def active? + return false unless @connection @connection.query 'select 1' true rescue Mysql2::Error