mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
better callstack reporting in deprecation messages
now the reported line is the first line in the stack that's outside Rails, which is the one that actually caused the problem in the first place [#5231 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
@@ -46,10 +46,14 @@ module ActiveSupport
|
||||
end
|
||||
|
||||
def extract_callstack(callstack)
|
||||
if md = callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/)
|
||||
md.captures
|
||||
else
|
||||
callstack.first
|
||||
rails_gem_root = File.expand_path("../../../../..", __FILE__) + "/"
|
||||
offending_line = callstack.find { |line| !line.start_with?(rails_gem_root) } || callstack.first
|
||||
if offending_line
|
||||
if md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/)
|
||||
md.captures
|
||||
else
|
||||
offending_line
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user