【发布时间】:2020-08-07 17:08:15
【问题描述】:
我在我的 rails 6 项目中注意到,将以下内容添加到 config/initializers/rails_admin.rb 会导致弃用警告:
RailsAdmin.config do |config|
config.parent_controller = ApplicationController.to_s
# ...
警告:
DEPRECATION WARNING: Initialization autoloaded the constants ApplicationHelper, AboutHelper, GroupHelper, MapHelper, DeviseHelper, 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 ApplicationHelper, 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 /opt/app/config/environment.rb:5)
一种解决方法是简单地使用"ApplicationController" 而不是ApplicationController.to_s,但是有没有办法在没有此弃用警告的情况下执行后一种方法?
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-6 rails-admin