From a51d4e6c25d1e76327665db0c897094a5308d4ef Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sat, 15 Jun 2013 14:51:17 +0200 Subject: Merge pull request #10925 from senny/10917_test_to_prevent_regression regression test + mysql2 adapter raises correct error if conn is closed. Conflicts: activerecord/CHANGELOG.md --- .../lib/active_record/connection_adapters/mysql2_adapter.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb index 524a7d30fc..c690b982a1 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -204,9 +204,11 @@ module ActiveRecord # Executes the SQL statement in the context of this connection. def execute(sql, name = nil) - # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been - # made since we established the connection - @connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone + if @connection + # make sure we carry over any changes to ActiveRecord::Base.default_timezone that have been + # made since we established the connection + @connection.query_options[:database_timezone] = ActiveRecord::Base.default_timezone + end super end -- cgit v1.2.3