codeplant/simple-navigation

simple-navigation causes deprecation warning in rails 6 initialization

benningm opened this issue · 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

andi commented

a PR would be highly appreciated :-)

Here it comes #223