当前位置:  开发笔记 > 后端 > 正文

uninitialized constant Resque :: Helpers启动rails服务器时

如何解决《uninitializedconstantResque::Helpers启动rails服务器时》经验,为你挑选了1个好方法。

尝试通过以下方式启动rails应用程序时出错rails s:

/Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/resque-scheduler-2.0.1/lib/resque/scheduler.rb:9:in `': uninitialized constant Resque::Helpers (NameError)
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/resque-scheduler-2.0.1/lib/resque/scheduler.rb:7:in `'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/resque-scheduler-2.0.1/lib/resque/scheduler.rb:5:in `'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:81:in `require'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:81:in `rescue in block in require'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /Users/nils/Uni/Masterarbeit/TweetTracker/config/application.rb:7:in `'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in '
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
    from /Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/railties-4.0.0/lib/rails/commands.rb:73:in `'
    from bin/rails:4:in `require'
    from bin/rails:4:in `
'

我在Ruby 1.9.3中使用Rails 4.在我的Gemfile中:

gem 'resque', "~> 2.0.0.pre.1", github: "resque/resque"
gem 'resque-scheduler'

和相应的初始化程序:

# reestablish DB connection for the forked process within each job
Resque.after_fork do
  ActiveRecord::Base.establish_connection
  resque_config = YAML.load_file(Rails.root.join("config", "resque.yml"))
  Resque.redis = resque_config[Rails.env]
end

# load resque config
resque_config = YAML.load_file(Rails.root.join("config", "resque.yml"))
Resque.redis = resque_config[Rails.env]

Dir[Rails.root.join("app", "jobs", "*.rb")].each { |file| require file }

require 'resque'
require 'resque/server'

# Load resque-scheduler schedule
require 'resque_scheduler'
require 'resque_scheduler/server'
Resque.schedule = YAML.load_file(Rails.root.join("config", "schedule.yml"))

我不知道该怎么做.:/



1> Viren..:

我认为不resque_scheduler兼容resque -"~> 2.0.0.pre.1"

因为Helper模块不再存在resque -"~> 2.0.0.pre.1"

点击这里最新 和1.x-stable也看到这里

尝试使用1.x-stable分支

希望这有帮助

推荐阅读
mobiledu2402851173
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有