Skip to content

Commit 44a4f27

Browse files
committed
Remove deprecated support to setting attr_internal_naming_format with a @ prefix
1 parent 3e68c79 commit 44a4f27

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

activesupport/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
* Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
2+
3+
*Rafael Mendonça França*
4+
15
* Remove deprecated `ActiveSupport::ProxyObject`.
26

37
*Rafael Mendonça França*

activesupport/lib/active_support/core_ext/module/attr_internal.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ class << self
2424

2525
def attr_internal_naming_format=(format)
2626
if format.start_with?("@")
27-
ActiveSupport.deprecator.warn <<~MESSAGE
28-
Setting `attr_internal_naming_format` with a `@` prefix is deprecated and will be removed in Rails 8.0.
27+
raise ArgumentError, <<~MESSAGE.squish
28+
Setting `attr_internal_naming_format` with a `@` prefix is not supported.
2929
3030
You can simply replace #{format.inspect} by #{format.delete_prefix("@").inspect}.
3131
MESSAGE
32-
33-
format = format.delete_prefix("@")
3432
end
33+
3534
@attr_internal_naming_format = format
3635
end
3736
end

activesupport/test/core_ext/module/attr_internal_test.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ def test_accessor
4444
assert_nothing_raised { assert_equal 1, @instance.foo }
4545
end
4646

47-
def test_naming_format_deprecation
47+
def test_invalid_naming_format
4848
assert_equal "_%s", Module.attr_internal_naming_format
49-
assert_deprecated(ActiveSupport.deprecator) do
49+
assert_raises(ArgumentError) do
5050
Module.attr_internal_naming_format = "@___%s"
5151
end
52-
assert_equal "___%s", Module.attr_internal_naming_format
5352
end
5453

5554
def test_naming_format

guides/source/8_0_release_notes.md

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

143143
* Remove deprecated `ActiveSupport::ProxyObject`.
144144

145+
* Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
146+
145147
### Deprecations
146148

147149
### Notable changes

0 commit comments

Comments
 (0)