diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-13 12:59:34 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-13 12:59:34 -0700 |
commit | 596ecf753eb87ee4f11fc87682b321c64b09d733 (patch) | |
tree | 215d1442dfc3e3156d1c6a50f412c669b543510d | |
parent | a782fea3592ed0e28f5f5d3815451198e8f40432 (diff) | |
parent | 21d9c0fc7f79f486fb2c67b3593e9496a1c57663 (diff) | |
download | rails-596ecf753eb87ee4f11fc87682b321c64b09d733.tar.gz rails-596ecf753eb87ee4f11fc87682b321c64b09d733.tar.bz2 rails-596ecf753eb87ee4f11fc87682b321c64b09d733.zip |
Merge pull request #5417 from kennyj/fix_5399-32
[3-2-stable] Fix GH #5399. connection_pools's keys are ActiveRecord::Base::ConnectionSpecification objects.
-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 |