Delete the initializer `initialize_dependency_mechanism`

The concept of dependencies mechanism disappears.

We do not remove the attribute in AS::Dependencies itself here, that
class is going to have a lot of code delete later.
This commit is contained in:
Xavier Noria 2021-08-09 22:36:25 +02:00
parent 6983a89c72
commit 0375657ce0
3 changed files with 6 additions and 24 deletions

View File

@ -274,18 +274,18 @@ Every Rails application comes with a standard set of middleware which it uses in
Rails.application.config.hosts << ".product.com"
```
You can exclude certain requests from Host Authorization checks by setting
You can exclude certain requests from Host Authorization checks by setting
`config.host_configuration.exclude`:
```ruby
# Exclude requests for the /healthcheck/ path from host checking
Rails.application.config.host_configuration = {
exclude: ->(request) { request.path =~ /healthcheck/ }
Rails.application.config.host_configuration = {
exclude: ->(request) { request.path =~ /healthcheck/ }
}
```
```
When a request comes to an unauthorized host, a default Rack application
will run and respond with `403 Forbidden`. This can be customized by setting
When a request comes to an unauthorized host, a default Rack application
will run and respond with `403 Forbidden`. This can be customized by setting
`config.host_configuration.response_app`. For example:
```ruby
@ -1665,8 +1665,6 @@ Below is a comprehensive list of all the initializers found in Rails in the orde
* `set_clear_dependencies_hook`: This initializer - which runs only if `cache_classes` is set to `false` - uses `ActionDispatch::Callbacks.after` to remove the constants which have been referenced during the request from the object space so that they will be reloaded during the following request.
* `initialize_dependency_mechanism`: If `config.cache_classes` is true, configures `ActiveSupport::Dependencies.mechanism` to `require` dependencies rather than `load` them.
* `bootstrap_hook`: Runs all configured `before_initialize` blocks.
* `i18n.callbacks`: In the development environment, sets up a `to_prepare` callback which will call `I18n.reload!` if any of the locales have changed since the last request. In production this callback will only run on the first request.

View File

@ -64,11 +64,6 @@ module Rails
end
end
# Sets the dependency loading mechanism.
initializer :initialize_dependency_mechanism, group: :all do
ActiveSupport::Dependencies.mechanism = config.cache_classes ? :require : :load
end
initializer :bootstrap_hook, group: :all do |app|
ActiveSupport.run_load_hooks(:before_initialize, app)
end

View File

@ -460,17 +460,6 @@ module ApplicationTests
end
end
test "initialize an eager loaded, cache classes app" do
add_to_config <<-RUBY
config.eager_load = true
config.cache_classes = true
RUBY
app "development"
assert_equal :require, ActiveSupport::Dependencies.mechanism
end
test "application is always added to eager_load namespaces" do
app "development"
assert_includes Rails.application.config.eager_load_namespaces, AppTemplate::Application