diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index 8029a0ca77..72bfe207d7 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -335,7 +335,7 @@ module Rails unless base.abstract_railtie? base.called_from = begin # Remove the line number from backtraces making sure we don't leave anything behind - call_stack = caller.map { |p| p.split(':')[0..-2].join(':') } + call_stack = caller.map { |p| p.sub(/:\d+.*/, '') } File.dirname(call_stack.detect { |p| p !~ %r[railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack] }) end end