Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorrect default for
config.autoload_paths
[ci skip]
The docs implied that the default for `config.autoload_paths` was the output of `Dir.glob("app/*")`. In reality, on a new Rails app the default is `[]`. Internally, Rails sets `ActiveSupport::Dependencies.autoload_paths` based on the union of [several configs](https://github.com/rails/rails/blob/v6.0.3.4/railties/lib/rails/engine.rb#L707), which is how `app` ends up being autoloaded (it is in `config.eager_load_paths` [by default](https://github.com/rails/rails/blob/v6.0.3.4/railties/lib/rails/engine/configuration.rb#L42)). I think this is worth clarifying, because the current docs implies code like this will do something: ```ruby config.autoload_paths -= ["#{config.root}/app/middleware"] ``` In reality it does nothing. This style of code is [discouraged](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#globs-in-config-autoload-paths) but that doesn't mean it's not out there :) :(
- Loading branch information