aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-03-14 02:11:40 +0900
committerkennyj <kennyj@gmail.com>2012-03-14 02:11:40 +0900
commitfdb8805cdd0d159763507e206a6ca3355b27f983 (patch)
tree24d51eb42fd41cae1191cfbb3d6d34e1425dbd55 /activerecord
parent21b69b233bda5870274c84ef8178c9ad9a47c390 (diff)
downloadrails-fdb8805cdd0d159763507e206a6ca3355b27f983.tar.gz
rails-fdb8805cdd0d159763507e206a6ca3355b27f983.tar.bz2
rails-fdb8805cdd0d159763507e206a6ca3355b27f983.zip
Fix GH #5399. connection_pools's keys are ActiveRecord::Base::ConnectionSpecification objects.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/core.rb2
-rw-r--r--activerecord/test/cases/multiple_db_test.rb8
2 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb
index e75a2a1cb4..46aababfb6 100644
--- a/activerecord/lib/active_record/core.rb
+++ b/activerecord/lib/active_record/core.rb
@@ -130,7 +130,7 @@ module ActiveRecord
end
def arel_engine
- @arel_engine ||= connection_handler.connection_pools[name] ? self : active_record_super.arel_engine
+ @arel_engine ||= connection_handler.retrieve_connection_pool(self) ? self : active_record_super.arel_engine
end
private
diff --git a/activerecord/test/cases/multiple_db_test.rb b/activerecord/test/cases/multiple_db_test.rb
index 917a03bb34..06d6596725 100644
--- a/activerecord/test/cases/multiple_db_test.rb
+++ b/activerecord/test/cases/multiple_db_test.rb
@@ -86,7 +86,13 @@ class MultipleDbTest < ActiveRecord::TestCase
end
def test_arel_table_engines
- assert_equal Entrant.arel_engine, Bird.arel_engine
+ assert_not_equal Entrant.arel_engine, Bird.arel_engine
+ assert_not_equal Entrant.arel_engine, Course.arel_engine
+ end
+
+ def test_connection
+ assert_equal Entrant.arel_engine.connection, Bird.arel_engine.connection
+ assert_not_equal Entrant.arel_engine.connection, Course.arel_engine.connection
end
unless in_memory_db?