1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05: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:
Jakub Suder 2010-08-20 20:05:38 +02:00 committed by José Valim
parent 0b9357d401
commit 4f945e97e5

View file

@ -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