We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e06d33 commit b8f19c9Copy full SHA for b8f19c9
activerecord/test/cases/associations_test.rb
@@ -1220,6 +1220,14 @@ def test_multi_database_polymorphic_preload_with_same_table_name
1220
other_dog_comment.origin_type = other_dog.class.name
1221
other_dog_comment.origin_id = other_dog.id
1222
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)
1231
assert_queries(2) do
1232
preloader = ActiveRecord::Associations::Preloader.new(records: [dog_comment, other_dog_comment], associations: :origin)
1233
preloader.call
0 commit comments