Ruby on rails Rails 5.2.3:Sidekiq调度程序提供NameError:生产中未初始化的常量
在我的Rails 5.2.3应用程序中,我有Ruby on rails Rails 5.2.3:Sidekiq调度程序提供NameError:生产中未初始化的常量,ruby-on-rails,sidekiq,ruby-on-rails-5.2,Ruby On Rails,Sidekiq,Ruby On Rails 5.2,在我的Rails 5.2.3应用程序中,我有config/sidekiq.yml如下所示: :verbose: true :concurrency: 30 :queues: - [mailers, 7] - [critical, 6] - [default, 5] - [low, 4] :logfile: ./log/sidekiq.log :schedule: ScheduledNotices: queue: low cron: '0 0 * * * *
config/sidekiq.yml
如下所示:
:verbose: true
:concurrency: 30
:queues:
- [mailers, 7]
- [critical, 6]
- [default, 5]
- [low, 4]
:logfile: ./log/sidekiq.log
:schedule:
ScheduledNotices:
queue: low
cron: '0 0 * * * *' # every hour
我的ScheduledNotices
放在lib\scheduled\u notices.rb
目前,在开发环境中工作正常,但在生产环境中,我遇到了以下错误:namererror:uninitialized constant ScheduledNotices
在my application.rb中,我有:
config.autoload_paths += %W(#{config.root}/lib)
请问我做错了什么?可以将其重新设置为路径自动加载问题,请检查此项以了解更多详细信息: 你应该做的是改变:
config.autoload_paths += %W(#{config.root}/lib)
到
config.eager\u load\u路径谢谢,看起来这就是解决方案。
config.eager_load_paths << Rails.root.join('lib')