Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[3-2-stable] Fix GH rails#5399. connection_pools's keys are ActiveRec…
…ord::Base::ConnectionSpecification objects.
  • Loading branch information
kennyj committed Mar 13, 2012
1 parent dfbbf31 commit 21d9c0f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/base.rb
Expand Up @@ -442,7 +442,7 @@ def arel_engine
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
Expand Down
8 changes: 7 additions & 1 deletion activerecord/test/cases/multiple_db_test.rb
Expand Up @@ -85,6 +85,12 @@ 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
end

0 comments on commit 21d9c0f

Please sign in to comment.