diff options
author | Yves Senn <yves.senn@gmail.com> | 2013-06-15 14:51:17 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-06-15 14:51:17 +0200 |
commit | a51d4e6c25d1e76327665db0c897094a5308d4ef (patch) | |
tree | 027c2440c168dfad43bb3ca58726c3fc473b0dce /activerecord/lib/active_record/connection_adapters | |
parent | f42e0fd3f4d3e2f4b806b001b6ed88c8da8cd833 (diff) | |
download | rails-a51d4e6c25d1e76327665db0c897094a5308d4ef.tar.gz rails-a51d4e6c25d1e76327665db0c897094a5308d4ef.tar.bz2 rails-a51d4e6c25d1e76327665db0c897094a5308d4ef.zip |
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
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb | 8 |
1 files changed, 5 insertions, 3 deletions
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 |