diff options
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/application/finisher.rb | 10 | ||||
-rw-r--r-- | railties/lib/rails/engine.rb | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb index b722679ec2..afa79cad1c 100644 --- a/railties/lib/rails/application/finisher.rb +++ b/railties/lib/rails/application/finisher.rb @@ -27,17 +27,19 @@ module Rails end end - initializer :build_middleware_stack do - app - end - # Fires the user-supplied after_initialize block (config.after_initialize) + # Should run before the middleware stack is built, because building the + # middleware already fires to_prepare callbacks in test and production. initializer :after_initialize do config.after_initialize_blocks.each do |block| block.call(self) end end + initializer :build_middleware_stack do + app + end + # Disable dependency loading during request cycle initializer :disable_dependency_loading do if config.cache_classes && !config.dependency_loading diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index a158bb7b70..efa11b466a 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -15,6 +15,7 @@ module Rails def inherited(base) unless abstract_railtie?(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.split(':')[0..-2].join(':') } File.dirname(call_stack.detect { |p| p !~ %r[railties[\w\-]*/lib/rails|rack[\w\-]*/lib/rack] }) end |