Permalink
Browse files

Fix GH #5399. connection_pools's keys are ActiveRecord::Base::Connect…

…ionSpecification objects.
  • Loading branch information...
1 parent 21b69b2 commit fdb8805cdd0d159763507e206a6ca3355b27f983 @kennyj committed Mar 13, 2012
Showing with 8 additions and 2 deletions.
  1. +1 −1 activerecord/lib/active_record/core.rb
  2. +7 −1 activerecord/test/cases/multiple_db_test.rb
View
2 activerecord/lib/active_record/core.rb
@@ -130,7 +130,7 @@ def arel_table
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
View
8 activerecord/test/cases/multiple_db_test.rb
@@ -86,7 +86,13 @@ def test_transactions_across_databases
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?

0 comments on commit fdb8805

Please sign in to comment.