Skip to content

Commit b93e843

Browse files
committed
Remove deprecation for duplicated query annotations
They are now ignored by the framework.
1 parent 3fb680a commit b93e843

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

activerecord/lib/active_record/relation/query_methods.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,14 +1339,6 @@ def build_arel(aliases = nil)
13391339
unless annotate_values.empty?
13401340
annotates = annotate_values
13411341
annotates = annotates.uniq if annotates.size > 1
1342-
unless annotates == annotate_values
1343-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
1344-
Duplicated query annotations are no longer shown in queries in Rails 7.0.
1345-
To migrate to Rails 7.0's behavior, use `uniq!(:annotate)` to deduplicate query annotations
1346-
(`#{klass.name&.tableize || klass.table_name}.uniq!(:annotate)`).
1347-
MSG
1348-
annotates = annotate_values
1349-
end
13501342
arel.comment(*annotates)
13511343
end
13521344

activerecord/test/cases/relation/merging_test.rb

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -374,25 +374,14 @@ def test_merging_duplicated_annotations
374374
posts.merge(posts).uniq!(:annotate).to_a
375375
end
376376

377-
message = <<-MSG.squish
378-
Duplicated query annotations are no longer shown in queries in Rails 7.0.
379-
To migrate to Rails 7.0's behavior, use `uniq!(:annotate)` to deduplicate query annotations
380-
(`posts.uniq!(:annotate)`).
381-
MSG
382-
assert_deprecated(message) do
383-
assert_sql(%r{FROM #{Regexp.escape(Post.quoted_table_name)} /\* foo \*/ /\* foo \*/\z}) do
384-
posts.merge(posts).to_a
385-
end
377+
assert_sql(%r{FROM #{Regexp.escape(Post.quoted_table_name)} /\* foo \*/\z}) do
378+
posts.merge(posts).to_a
386379
end
387-
assert_deprecated(message) do
388-
assert_sql(%r{FROM #{Regexp.escape(Post.quoted_table_name)} /\* foo \*/ /\* bar \*/ /\* foo \*/\z}) do
389-
Post.annotate("foo").merge(Post.annotate("bar")).merge(posts).to_a
390-
end
380+
assert_sql(%r{FROM #{Regexp.escape(Post.quoted_table_name)} /\* foo \*/ /\* bar \*/\z}) do
381+
Post.annotate("foo").merge(Post.annotate("bar")).merge(posts).to_a
391382
end
392-
assert_deprecated(message) do
393-
assert_sql(%r{FROM #{Regexp.escape(Post.quoted_table_name)} /\* bar \*/ /\* foo \*/ /\* foo \*/\z}) do
394-
Post.annotate("bar").merge(Post.annotate("foo")).merge(posts).to_a
395-
end
383+
assert_sql(%r{FROM #{Regexp.escape(Post.quoted_table_name)} /\* bar \*/ /\* foo \*/\z}) do
384+
Post.annotate("bar").merge(Post.annotate("foo")).merge(posts).to_a
396385
end
397386
end
398387
end

0 commit comments

Comments
 (0)