2
0

More than 3 years have passed since last update.

Rails6 の Zeitwerk と XXXHelper の DEPRECATION WARNINGと OmniAuth

Posted at

あるプロジェクトを Rails 6 にアップグレードしたら、DEPRECATION WARNING が出るようになりました。

DEPRECATION WARNING: Initialization autoloaded the constants ApplicationHelper, AaaHelper, BbbHelper, ..., ActionText::ContentHelper, and ActionText::TagHelper.

ApplicationHelper で grep する

なるほど〜。これは、例の Zeitwerk のワーニングだなとピンと来た私は、
config/initializers 内のファイルとかで ApplicationHelper を参照しているのかと思い、ApplicationHelper で grep してみたのでした。

すんなり解決できるかと探してみましたが、 app/helpers/application_helper.rb 以外に
ApplicationHelper と書いて使っているところなんてどこにも見つからない...。
何が悪いの?

Rails の ISSUE を見つける

Google で検索してみたところ、 Rails の ISSUEが見つかりました。
zeitwerk doesn't autoreload the helpers

まさにここに書いてある通り

OmniAuth.config.on_failure = XxxxController.action(:failure)

としてました。

これを参考にして、

OmniAuth.config.after_initialize do
  OmniAuth.config.on_failure = XxxxController.action(:failure)
end

に修正することで解消できました。

参考情報

2
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
2
0