Skip to Content

Rails - Trace source of deprecation warnings

Posted on

When I run rspec spec, Rails shows some warnings for deprecated code. For example:

DEPRECATION WARNING: has been deprecated and
from Rails 7.1 will use the default Ruby implementation.
You can set `config.active_support.remove_deprecated_time_with_zone_name = true`
to enable the new behavior now.

(called from block (3 levels) in <top (required)> at /project_name/spec/libs/file_name.rb:10)

But I don’t know where it came from, cause in my lib, I don’t use

I found a way to trace source of deprecation warning after some searching. We can enable the full debugging information by using this code:

ActiveSupport::Deprecation.debug = true

So we can see the call stack of this deprecation warning.


comments powered by Disqus