diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-09-10 11:07:41 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-09-10 11:07:41 -0700 |
commit | d68419a88e424e588c2d8decc69874bd00588766 (patch) | |
tree | cc3a3276b79681050424be1a2a0b3fc0a4df3de1 /railties/lib/rails | |
parent | 05f88b7b0499781f87e9e79cbec4d01193db2352 (diff) | |
parent | 5374960a04d7333ced9b6c4ca36b708af498b1ca (diff) | |
download | rails-d68419a88e424e588c2d8decc69874bd00588766.tar.gz rails-d68419a88e424e588c2d8decc69874bd00588766.tar.bz2 rails-d68419a88e424e588c2d8decc69874bd00588766.zip |
Merge pull request #12193 from arunagw/revert-revert
Revert fixes
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/engine.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index f25f629aa5..e8adef2fd3 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -351,8 +351,13 @@ module Rails Rails::Railtie::Configuration.eager_load_namespaces << base base.called_from = begin - # Remove the line number from backtraces making sure we don't leave anything behind - call_stack = caller.map { |p| p.sub(/:\d+.*/, '') } + call_stack = if Kernel.respond_to?(:caller_locations) + caller_locations.map(&:path) + else + # Remove the line number from backtraces making sure we don't leave anything behind + caller.map { |p| p.sub(/:\d+.*/, '') } + end + File.dirname(call_stack.detect { |p| p !~ %r[railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack] }) end end |