mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Remove check for caller_locations in Rails::Engine
This is no longer necessary, as the minimum version requirement for Ruby is 2.2.2, and the `caller_locations` feature was added in Ruby 2.0.0. Since Rails no longer supports pre 2.0 versions of Ruby, there is no need to check first if the Kernel does respond to `caller_locations`. The answer is: yes it does.
This commit is contained in:
parent
52cf1a71b3
commit
f96b19b6da
1 changed files with 1 additions and 6 deletions
|
@ -357,12 +357,7 @@ module Rails
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue