Rails (Zeitwerk Mode) DEPRECATION WARNING: Initialization autoloaded the constant ApplicationHelper

charlie_hsieh · November 04, 2021 · Last by zhengpd replied at November 05, 2021 · 218 hits

请问有人遇到过这个 warning ?

DEPRECATION WARNING: Initialization autoloaded the constant ApplicationHelper

貌似 很多 code 都有受到影响。

https://guides.rubyonrails.org/autoloading_and_reloading_constants.html

In order to autoload safely at boot time, please wrap your code in a reloader
callback this way:

    Rails.application.reloader.to_prepare do
      # Autoload classes and modules needed at boot time here.
    end

rails 初始化过程中 autoload 的 ApplicationHelper,在改了文件触发 reload 之后的 ApplicationHelper 可能不一致,大概是这个问题

You need to Sign in before reply, if you don't have an account, please Sign up first.