diff options
author | Xavier Noria <fxn@hashref.com> | 2019-07-12 18:56:04 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2019-07-12 18:56:04 +0200 |
commit | 727da1d8cdcab3ff50e399053faf7ba84e05ce03 (patch) | |
tree | 507c2710a28f7055151ae889734cb5e12c4f9b62 /guides/source/upgrading_ruby_on_rails.md | |
parent | 43ae74f6f66999671b3cd2a6747e3d8fecf09b1c (diff) | |
download | rails-727da1d8cdcab3ff50e399053faf7ba84e05ce03.tar.gz rails-727da1d8cdcab3ff50e399053faf7ba84e05ce03.tar.bz2 rails-727da1d8cdcab3ff50e399053faf7ba84e05ce03.zip |
ports edits to the upgrading guide [skip ci]
Diffstat (limited to 'guides/source/upgrading_ruby_on_rails.md')
-rw-r--r-- | guides/source/upgrading_ruby_on_rails.md | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 4192063e9b..123f8dce80 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -201,6 +201,29 @@ bin/rails zeitwerk:check When all is good, you can delete `config.autoloader = :classic`. +That checker may technically be fooled in some rare cases, but it works well in practice for projects that are running correctly in a previous versions of Rails and are being upgraded. This task tries to print a helpful report. + +If that check is good, we recommend to do a second one, more strict: Eager load the application in `zeitwerk` mode. In order to do that, enable eager loading in `development` mode: + +```ruby +# config/initializers/development.rb +config.eager_load = true +``` + +and boot the application: + +```ruby +bin/rails runner 1 +``` + +If a file does not match the constant it defines, you'll get a raw `NameError` explaining the discrepancy: + +``` +expected file ... to define constant ..., but didn't (NameError) +``` + +Once all is good, you'll just get a prompt back. Remember to disable `config.eager_load`, it it was false before. + #### require_dependency All known use cases of `require_dependency` have been eliminated, you should grep the project and delete them. |