Skip to content

Commit 89c2c91

Browse files
committed
Eager load Rails::BacktraceCleaner
Previously, Rails::BacktraceCleaner was both lazily required and instantiated. While it would end up being loaded during initialization for apps that use Active Record (due to active_record.backtrace_cleaner initializer), it would not be loaded until the first request for those that don't. The solution is similar to daff36c, however ::Rails is not currently in the list of eager_load_namespaces. Therefore simply requiring it seems like the easiest solution. The removed comment indicating the lazy require is necessary due to load order dates back to the addition of Rails::BacktraceCleaner in f42c77f. This predates the integration of Bundler and reorganization of framework loading, so it is no longer accurate.
1 parent 9589ef3 commit 89c2c91

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

railties/lib/rails.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
require "rails/version"
1414
require "rails/deprecator"
1515
require "rails/application"
16+
require "rails/backtrace_cleaner"
1617

1718
require "active_support/railtie"
1819
require "action_dispatch/railtie"
@@ -49,11 +50,7 @@ def configuration
4950
end
5051

5152
def backtrace_cleaner
52-
@backtrace_cleaner ||= begin
53-
# Relies on Active Support, so we have to lazy load to postpone definition until Active Support has been loaded
54-
require "rails/backtrace_cleaner"
55-
Rails::BacktraceCleaner.new
56-
end
53+
@backtrace_cleaner ||= Rails::BacktraceCleaner.new
5754
end
5855

5956
# Returns a Pathname object of the current Rails project,

0 commit comments

Comments
 (0)