Skip to content

Commit b8f19c9

Browse files
committed
Add explanatory comment to test case
1 parent 9e06d33 commit b8f19c9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

activerecord/test/cases/associations_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,14 @@ def test_multi_database_polymorphic_preload_with_same_table_name
12201220
other_dog_comment.origin_type = other_dog.class.name
12211221
other_dog_comment.origin_id = other_dog.id
12221222

1223+
# Both Dog and OtherDog are backed by a table named `dogs`,
1224+
# however they are stored in different databases and should
1225+
# therefore result in two separate queries rather than be batched
1226+
# together.
1227+
#
1228+
# Expected
1229+
# SELECT FROM dogs ... (Dog)
1230+
# SELECT FROM dogs ... (OtherDog)
12231231
assert_queries(2) do
12241232
preloader = ActiveRecord::Associations::Preloader.new(records: [dog_comment, other_dog_comment], associations: :origin)
12251233
preloader.call

0 commit comments

Comments
 (0)