lib/active_support/deprecation/reporting.rb in activesupport-7.1.5 vs lib/active_support/deprecation/reporting.rb in activesupport-7.2.0.beta1

- old
+ new

@@ -149,11 +149,16 @@ [offending_line.path, offending_line.lineno, offending_line.label] end def _extract_callstack(callstack) - warn "Please pass `caller_locations` to the deprecation API" if $VERBOSE + ActiveSupport.deprecator.warn(<<~MESSAGE) + Passing the result of `caller` to ActiveSupport::Deprecation#warn is deprecated and will be removed in Rails 7.3. + + Please pass the result of `caller_locations` instead. + MESSAGE + offending_line = callstack.find { |line| !ignored_callstack?(line) } || callstack.first if offending_line if md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/) md.captures @@ -161,14 +166,14 @@ offending_line end end end - RAILS_GEM_ROOT = File.expand_path("../../../..", __dir__) + "/" # :nodoc: - LIB_DIR = RbConfig::CONFIG["libdir"] # :nodoc: + RAILS_GEM_ROOT = File.expand_path("../../../..", __dir__) + "/" + LIB_DIR = RbConfig::CONFIG["libdir"] def ignored_callstack?(path) - path.start_with?(RAILS_GEM_ROOT, LIB_DIR) + path.start_with?(RAILS_GEM_ROOT, LIB_DIR) || path.include?("<internal:") end end end end