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:
parent
0b9357d401
commit
4f945e97e5
1 changed files with 8 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue