Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails 5.2.3:Sidekiq调度程序提供NameError:生产中未初始化的常量_Ruby On Rails_Sidekiq_Ruby On Rails 5.2 - Fatal编程技术网

Ruby on rails Rails 5.2.3:Sidekiq调度程序提供NameError:生产中未初始化的常量

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 * * * *

在我的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 * * * *' # 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')