Skip to content

Commit

Permalink
Merge pull request #20986 from radar/rails-engine-caller-locations
Browse files Browse the repository at this point in the history
Remove check for caller_locations in Rails::Engine
  • Loading branch information
Arthur Nogueira Neves committed Oct 5, 2015
2 parents e202d59 + f96b19b commit 280c09a
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions railties/lib/rails/engine.rb
Expand Up @@ -358,12 +358,7 @@ def inherited(base)
Rails::Railtie::Configuration.eager_load_namespaces << base

base.called_from = begin
call_stack = if Kernel.respond_to?(:caller_locations)
caller_locations.map { |l| l.absolute_path || l.path }
else
# Remove the line number from backtraces making sure we don't leave anything behind
caller.map { |p| p.sub(/:\d+.*/, '') }
end
call_stack = caller_locations.map { |l| l.absolute_path || l.path }

File.dirname(call_stack.detect { |p| p !~ %r[railties[\w.-]*/lib/rails|rack[\w.-]*/lib/rack] })
end
Expand Down

0 comments on commit 280c09a

Please sign in to comment.