restarone / violet_rails

an app engine for your business. Seamlessly implement business logic with a powerful API. Out of the box CMS, blog, forum and email functionality. Developer friendly & easily extendable for your next SaaS/XaaS project. Built with Rails 6, Devise, Sidekiq & PostgreSQL
https://violet.restarone.solutions
MIT License
95 stars 43 forks source link

fix autoload deprecation warning #458

Open donrestarone opened 2 years ago

donrestarone commented 2 years ago
solutions_sidekiq    | 2022-04-23T03:39:25.183Z pid=1 tid=gmo8hx245 WARN: DEPRECATION WARNING: Initialization autoloaded the constants EmberCliRailsAssetsHelper, ApplicationHelper, ApiClientsHelper, ApiFormsHelper, ApiNamespacesHelper, ApiResourcesHelper, ContentHelper, DashboardHelper, MessagesHelper, SearchHelper, SigninWizardHelper, SignupWizardHelper, SimpleDiscussion::ForumPostsHelper, SimpleDiscussion::ForumThreadsHelper, SubdomainHelper, UsersHelper, EmberRailsHelper, LocalTimeHelper, Comfy, Comfy::Admin, Comfy::Admin::CmsHelper, Comfy::CmsHelper, DeviseHelper, and ApplicationController.
solutions_sidekiq    |
solutions_sidekiq    | Being able to do this is deprecated. Autoloading during initialization is going
solutions_sidekiq    | to be an error condition in future versions of Rails.
solutions_sidekiq    |
solutions_sidekiq    | Reloading does not reboot the application, and therefore code executed during
solutions_sidekiq    | initialization does not run again. So, if you reload EmberCliRailsAssetsHelper, for example,
solutions_sidekiq    | the expected changes won't be reflected in that stale Module object.
solutions_sidekiq    |
solutions_sidekiq    | These autoloaded constants have been unloaded.
solutions_sidekiq    |
solutions_sidekiq    | In order to autoload safely at boot time, please wrap your code in a reloader
solutions_sidekiq    | callback this way:
solutions_sidekiq    |
solutions_sidekiq    |     Rails.application.reloader.to_prepare do
solutions_sidekiq    |       # Autoload classes and modules needed at boot time here.
solutions_sidekiq    |     end
solutions_sidekiq    |
solutions_sidekiq    | That block runs when the application boots, and every time there is a reload.
solutions_sidekiq    | For historical reasons, it may run twice, so it has to be idempotent.
solutions_sidekiq    |
solutions_sidekiq    | Check the "Autoloading and Reloading Constants" guide to learn more about how
solutions_sidekiq    | Rails autoloads and reloads.
solutions_sidekiq    |  (called from <top (required)> at /var/app/config/environment.rb:5)

Research:

  1. https://ryanfb.github.io/etc/2021/06/25/diagnosing_rails_6_deprecation_warning_-initialization_autoloaded_the_constants.html
  2. https://bill.harding.blog/2021/07/22/rails-6-1-deprecation-warning-initialization-autoloaded-the-constants-what-to-do-about-it/
donrestarone commented 2 years ago

could be caused by mailgun, try upgrading the library

https://github.com/mailgun/mailgun-ruby/issues/215

UPDATE not caused by mailgun. Its caused by ember-cli-rails

donrestarone commented 2 years ago

POC: https://github.com/restarone/violet_rails/pull/808