diff options
author | kennyj <kennyj@gmail.com> | 2012-03-14 02:34:12 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-03-14 02:34:12 +0900 |
commit | 21d9c0fc7f79f486fb2c67b3593e9496a1c57663 (patch) | |
tree | 30358e92723f4599a67bf6f4a9fb65c3c297b6b3 /activerecord | |
parent | dfbbf31dd2056d989cac8f1942130d93aa841e1b (diff) | |
download | rails-21d9c0fc7f79f486fb2c67b3593e9496a1c57663.tar.gz rails-21d9c0fc7f79f486fb2c67b3593e9496a1c57663.tar.bz2 rails-21d9c0fc7f79f486fb2c67b3593e9496a1c57663.zip |
[3-2-stable] Fix GH #5399. connection_pools's keys are ActiveRecord::Base::ConnectionSpecification objects.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/multiple_db_test.rb | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 425cd8cbab..9746efc7d1 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -442,7 +442,7 @@ module ActiveRecord #:nodoc: if self == ActiveRecord::Base ActiveRecord::Base else - connection_handler.connection_pools[name] ? self : superclass.arel_engine + connection_handler.retrieve_connection_pool(self) ? self : superclass.arel_engine end end end diff --git a/activerecord/test/cases/multiple_db_test.rb b/activerecord/test/cases/multiple_db_test.rb index e704322b5d..b31d971309 100644 --- a/activerecord/test/cases/multiple_db_test.rb +++ b/activerecord/test/cases/multiple_db_test.rb @@ -85,6 +85,12 @@ 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 end |