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 ====================================
def active?
return false unless @connection
@connection.query 'select 1'
true
rescue Mysql2::Error