LoginSignup
0
0

More than 1 year has passed since last update.

rails6.0へ更新後, solidusのクラスでInitialization autoloaded the constantsのwarningが出た際の対処

Posted at

rails 6.0.0
solidus 2.11.9
zeitwerk使用

test environmentの時だけ下記の様なwarningが出るようになっていた。

DEPRECATION WARNING: Initialization autoloaded the constants Spree::AuthConfiguration, MailLogObserver

特にconfig/initializerで何かしているわけでもない、solidus側のissue等確認しても出ている場合は自分のコードに何かあるという事しか書いてなかったので原因が不明だったが、warning発生前後をチェックするとapp:update時にconfig/environments/test.rbのcache_classesをfalseにしていた。
trueにすることでwarningが出なくなるのを確認, solidusは最終的に関係無かった。

修正前

config/environments/test.rb
require "active_support/core_ext/integer/time"

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.
  config.cache_classes = false
  # etc...
end

修正後

config/environments/test.rb
require "active_support/core_ext/integer/time"

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.
  config.cache_classes = true
  # etc...
end

ただアップグレードガイドのこの部分に引っかからなかったのがまだ分かりきってないので調べる。

spring gemは、アプリケーションのコードが変更されると再読み込みします。test環境では、そのために再読み込みを有効にしておく必要があります。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0