我遵循了 config/application.rb 中的注释指南,即
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
但是当我添加Rails.application.config.eager_load_paths << Rails.root.join('lib')
.config/initializers/eager_load.rb
它抛出<top (required)>': can't modify frozen Array (RuntimeError)
是的,如果我把它放在里面,它就可以工作config/application.rb
。
我想知道为什么它在初始化程序上不起作用以及如何使用约定使它起作用?