Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/rails zeitwerk:check displays deprecation warning on Rails 6.0.3.4 #15

Closed
mrbongiolo opened this issue Dec 22, 2020 · 3 comments
Closed

Comments

@mrbongiolo
Copy link

mrbongiolo commented Dec 22, 2020

DEPRECATION WARNING: Initialization autoloaded the constants Turbo::Streams, Turbo::Streams::TurboStreamsTagBuilder, Turbo::Frames, Turbo::Frames::FrameRequest, Turbo::Native, Turbo::Native::Navigation, Turbo::DriveHelper, Turbo::FramesHelper, Turbo::IncludesHelper, Turbo::StreamsHelper, Turbo::Streams::ActionHelper, and Turbo::Broadcastable.

Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.

Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload Turbo::Streams, for example,
the expected changes won't be reflected in that stale Module object.

These autoloaded constants have been unloaded.

Please, check the "Autoloading and Reloading Constants" guide for solutions.
 (called from <top (required)> at /config/environment.rb:7)
Hold on, I am eager loading the application.
rails aborted!
@sedubois
Copy link

sedubois commented Dec 23, 2020

In my Rails 6.1.0 app I get this after adding gem 'turbo-rails', don't know how to proceed:

Exiting
Uncaught exception: DEPRECATION WARNING: Initialization autoloaded the constant Turbo::Broadcastable.

Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.

Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload Turbo::Broadcastable, for example,
the expected changes won't be reflected in that stale Module object.

This autoloaded constant has been unloaded.

In order to autoload safely at boot time, please wrap your code in a reloader
callback this way:

    Rails.application.reloader.to_prepare do
      # Autoload classes and modules needed at boot time here.
    end

That block runs when the application boots, and every time there is a reload.
For historical reasons, it may run twice, so it has to be idempotent.

Check the "Autoloading and Reloading Constants" guide to learn more about how
Rails autoloads and reloads.
 (called from <main> at .../config/environment.rb:5)
 ...

@fxn
Copy link
Contributor

fxn commented Dec 26, 2020

I am preparing a patch to address these ones.

@dhh
Copy link
Member

dhh commented Dec 28, 2020

Fixed via #51.

@dhh dhh closed this as completed Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants