Skip to content

Commit 2d97136

Browse files
Merge pull request rails#46580 from jonathanhefner/deprecated_constant_accessor-vs-deprecated_constant_proxy
Prefer `deprecate_constant` over constant proxy
2 parents 32e8aa6 + 1e68400 commit 2d97136

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

actionview/lib/action_view/template/resolver.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
module ActionView
1111
# = Action View Resolver
1212
class Resolver
13-
Path = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("ActionView::Resolver::Path", "ActionView::TemplatePath", ActionView.deprecator)
13+
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
14+
deprecate_constant "Path", "ActionView::TemplatePath", deprecator: ActionView.deprecator
1415

1516
class PathParser # :nodoc:
1617
ParsedPath = Struct.new(:path, :details)

railties/lib/rails/generators/testing/behavior.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ def migration_file_name(relative)
108108
end
109109
end
110110

111-
Behaviour = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("Rails::Generators::Testing::Behaviour", "Rails::Generators::Testing::Behavior", Rails.deprecator)
111+
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
112+
deprecate_constant "Behaviour", "Rails::Generators::Testing::Behavior", deprecator: Rails.deprecator
112113
end
113114
end
114115
end

railties/test/generators_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def test_hide_namespace
256256

257257
def test_behaviour_aliases_behavior
258258
assert_deprecated(Rails.deprecator) do
259-
assert_same Rails::Generators::Testing::Behavior, Rails::Generators::Testing::Behaviour.itself
259+
assert_same Rails::Generators::Testing::Behavior, Rails::Generators::Testing::Behaviour
260260
end
261261
end
262262
end

0 commit comments

Comments
 (0)