don't attempt a query unless a connection exists to do it on

This commit is contained in:
Brian Lopez 2010-07-26 00:10:49 -07:00
parent 20ef2e5e27
commit 56ecff58bf

View File

@ -231,6 +231,7 @@ module ActiveRecord
# CONNECTION MANAGEMENT ==================================== # CONNECTION MANAGEMENT ====================================
def active? def active?
return false unless @connection
@connection.query 'select 1' @connection.query 'select 1'
true true
rescue Mysql2::Error rescue Mysql2::Error