Project

General

Profile

Actions

Patch #41141

open

Replace deprecated `ActiveSupport::Deprecation.warn` with custom deprecation object

Added by Go MAEDA 6 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Code cleanup/refactoring
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

The usage of ActiveSupport::Deprecation.warn has been deprecated in Rails 7.1 and has been removed in Rails 7.2.
The attached patch fixes the deprecated usage by replacing ActiveSupport::Deprecation with a custom deprecation object.

In Rails 7.1.2, calling ActiveSupport::Deprecation.warn produces the following deprecation warning:

$ bin/rails r 'ActiveSupport::Deprecation.warn("warning!")'
DEPRECATION WARNING: warning! (called from require at bin/rails:4)
DEPRECATION WARNING: Calling warn on ActiveSupport::Deprecation is deprecated and will be removed from Rails (use your own Deprecation object instead) (called from require at bin/rails:4)

In Rails 7.2.0, the method is removed, resulting in an error:

$ bin/rails r 'ActiveSupport::Deprecation.warn("warning!")'
Please specify a valid ruby command or the path of a script to run.
Run 'bin/rails runner -h' for help.

private method `warn' called for class ActiveSupport::Deprecation


Files

No data to display

Actions

Also available in: Atom PDF