diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-11-29 15:04:41 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-11-29 15:04:41 -0800 |
commit | 0e2477b602b3aa5b66c849d19737a8b66c73f633 (patch) | |
tree | 2881fbaee090bc9472210d0554799867f319a20f /activerecord/test/cases/transactions_test.rb | |
parent | 29d2040b2992c112ca475a7a56bcd7f2016252ce (diff) | |
download | rails-0e2477b602b3aa5b66c849d19737a8b66c73f633.tar.gz rails-0e2477b602b3aa5b66c849d19737a8b66c73f633.tar.bz2 rails-0e2477b602b3aa5b66c849d19737a8b66c73f633.zip |
Automatic closure of connections in threads is deprecated. For example
the following code is deprecated:
Thread.new { Post.find(1) }.join
It should be changed to close the database connection at the end of
the thread:
Thread.new {
Post.find(1)
Post.connection.close
}.join
Only people who spawn threads in their application code need to worry
about this change.
Diffstat (limited to 'activerecord/test/cases/transactions_test.rb')
-rw-r--r-- | activerecord/test/cases/transactions_test.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/test/cases/transactions_test.rb b/activerecord/test/cases/transactions_test.rb index 110a18772f..203dd054f1 100644 --- a/activerecord/test/cases/transactions_test.rb +++ b/activerecord/test/cases/transactions_test.rb @@ -563,6 +563,7 @@ if current_adapter?(:PostgreSQLAdapter) topic.approved = !topic.approved? topic.save! end + Topic.connection.close end end @@ -598,6 +599,7 @@ if current_adapter?(:PostgreSQLAdapter) dev = Developer.find(1) assert_equal original_salary, dev.salary end + Developer.connection.close end end @@ -610,6 +612,7 @@ if current_adapter?(:PostgreSQLAdapter) assert_equal original_salary, Developer.find(1).salary end end + Developer.connection.close end threads.each { |t| t.join } |