Skip to content

Commit 80b416f

Browse files
committed
Add option to enable dependency loading in production
This will make easier to applications that rely on having const_missing hooks in production upgrade to Rails 5. This option is going to be remove in the future and the default behavior will be to disable the dependency loading.
1 parent 7b0b3d8 commit 80b416f

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

guides/source/configuring.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ application. Accepts a valid week day symbol (e.g. `:monday`).
9494

9595
* `config.eager_load_paths` accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. Defaults to every folder in the `app` directory of the application.
9696

97+
* `config.enable_dependency_loading` when true, enable the autoload loading behavior even if the application is eager loaded and have `cache_classes` as true. Default to false.
98+
9799
* `config.encoding` sets up the application-wide encoding. Defaults to UTF-8.
98100

99101
* `config.exceptions_app` sets the exceptions application invoked by the ShowException middleware when an exception happens. Defaults to `ActionDispatch::PublicExceptions.new(Rails.public_path)`.

railties/lib/rails/application/finisher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def self.complete(_state)
176176

177177
# Disable dependency loading during request cycle
178178
initializer :disable_dependency_loading do
179-
if config.eager_load && config.cache_classes
179+
if config.eager_load && config.cache_classes && !config.enable_dependency_loading
180180
ActiveSupport::Dependencies.unhook!
181181
end
182182
end

0 commit comments

Comments
 (0)