Skip to content

Commit 485d3e9

Browse files
committed
Remove deprecated ActiveRecord::Result#map! and ActiveRecord::Result#collect!
1 parent 11aae13 commit 485d3e9

File tree

4 files changed

+6
-27
lines changed

4 files changed

+6
-27
lines changed

activerecord/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated `ActiveRecord::Result#map!` and `ActiveRecord::Result#collect!`.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated `ActiveRecord::Base.configurations.to_h`.
26

37
*Rafael Mendonça França*

activerecord/lib/active_record/result.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,6 @@ def each(&block)
7272
end
7373
end
7474

75-
alias :map! :map
76-
alias :collect! :map
77-
deprecate "map!": :map
78-
deprecate "collect!": :map
79-
8075
# Returns true if there are no records, otherwise false.
8176
def empty?
8277
rows.empty?

activerecord/test/cases/result_test.rb

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,6 @@ def result
1212
])
1313
end
1414

15-
test "map! is deprecated" do
16-
assert_deprecated do
17-
result.map! { nil }
18-
end
19-
assert_equal [
20-
{ "col_1" => "row 1 col 1", "col_2" => "row 1 col 2" },
21-
{ "col_1" => "row 2 col 1", "col_2" => "row 2 col 2" },
22-
{ "col_1" => "row 3 col 1", "col_2" => "row 3 col 2" },
23-
], result.to_a
24-
end
25-
26-
test "collect! is deprecated" do
27-
assert_deprecated do
28-
result.collect! { nil }
29-
end
30-
assert_equal [
31-
{ "col_1" => "row 1 col 1", "col_2" => "row 1 col 2" },
32-
{ "col_1" => "row 2 col 1", "col_2" => "row 2 col 2" },
33-
{ "col_1" => "row 3 col 1", "col_2" => "row 3 col 2" },
34-
], result.to_a
35-
end
36-
3715
test "includes_column?" do
3816
assert result.includes_column?("col_1")
3917
assert_not result.includes_column?("foo")

guides/source/7_0_release_notes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ Please refer to the [Changelog][active-job] for detailed changes.
262262

263263
* Remove deprecated `ActiveRecord::Base.configurations.to_h`.
264264

265+
* Remove deprecated `ActiveRecord::Result#map!` and `ActiveRecord::Result#collect!`.
266+
265267
### Deprecations
266268

267269
* Deprecated `Rails.config.active_job.skip_after_callbacks_if_terminated`.

0 commit comments

Comments
 (0)