auto-session-timeout icon indicating copy to clipboard operation
auto-session-timeout copied to clipboard

Rails 6 Zeitwerk Warning

Open aidandamerell opened this issue 5 years ago • 5 comments

DEPRECATION WARNING: Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper.

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 ActionText::ContentHelper, 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 XXX

aidandamerell avatar Oct 30 '19 19:10 aidandamerell

Thanks for alerting me to this. I've been working on a new version of this gem that's compatible with Rails 6 and will incorporate this feedback into those changes.

pelargir avatar Nov 07 '19 16:11 pelargir

I'm seeing this warning as well. Any progress on Rails 6 compatibility?

moveson avatar Feb 07 '21 16:02 moveson

@aidandamerell @moveson I'm curious where you both are seeing this. In the Rails log?

I'm running the gem on a freshly created Rails 6.1 project (with Devise) and I'm not seeing these warnings in the log, at least not in development mode. If you can provide more detail I'd like to help.

pelargir avatar Feb 07 '21 19:02 pelargir

Hey, I seem to be in the same boat although my error only includes ActionText::ContentHelper.

This is a rails 6.0 app that is being bumped to 6.1.

Will keep poking around to see if I can figure out what is going on. Curious if @aidandamerell or @moveson made progress?

Cleaned backtrace:
        auto-session-timeout (0.9.7) lib/auto_session_timeout.rb:56:in `<main>'
        auto-session-timeout (0.9.7) lib/auto-session-timeout.rb:1:in `<main>'
        /app/config/application.rb:26:in `<main>'
        /app/rakefile:4:in `<main>'
        rake (13.0.3) lib/rake/rake_module.rb:29:in `load_rakefile'
        rake (13.0.3) lib/rake/application.rb:703:in `raw_load_rakefile'
        rake (13.0.3) lib/rake/application.rb:104:in `block in load_rakefile'
        rake (13.0.3) lib/rake/application.rb:186:in `standard_exception_handling'
        rake (13.0.3) lib/rake/application.rb:103:in `load_rakefile'
        rake (13.0.3) lib/rake/rake_module.rb:59:in `with_application'
        /app/bin/rails:10:in `<top (required)>'
        /app/bin/spring:15:in `require'
        /app/bin/spring:15:in `<top (required)>'
Most probably the cause is: auto-session-timeout (0.9.7) lib/auto_session_timeout.rb:56:in `<main>'

In a completely unscientific experiment the following seems to remove the error:

# lib/auto_session_timeout.rb:56
ActiveSupport.on_load(:action_controller) do
  ActionController::Base.send :include, AutoSessionTimeout
end

krsyoung avatar Mar 08 '21 18:03 krsyoung

Are you still getting this warning? It shouldn't be happening any longer.

pelargir avatar Mar 11 '23 12:03 pelargir