simple-navigation icon indicating copy to clipboard operation
simple-navigation copied to clipboard

simple-navigation causes deprecation warning in rails 6 initialization

Open benningm opened this issue 5 years ago • 2 comments

Initialization of this gem triggers a deprecation warning in rails 6:

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 <main> at /myapp/config/environment.rb:5)

Steps to reproduce

# gem install rails --version 6.0.0.rc2
# rails new myapp --skip-javascript
# cd myapp
# rails db:setup
# rails db:migrate
# rails server
verify it works CTRL-C
# tail log/development.log
no warnings
# echo "gem 'simple-navigation'" >> Gemfile
# bundle install
# rails server
verify it works CTRL-C
# tail -n 13 log/development.log
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 <main> at /myapp/config/environment.rb:5)

Analysis

The initialization of this gem seems to trigger an autoload of ActionController::Base which triggers the loading of the ActionText helpers.

Autoloading in intializers is going to be deprecated.

see also rails/rails#36546

benningm avatar Aug 02 '19 15:08 benningm

a PR would be highly appreciated :-)

andi avatar Aug 04 '19 19:08 andi

Here it comes #223

benningm avatar Aug 05 '19 09:08 benningm