尝试通过rails s
启动我的rails应用程序时收到错误:
/Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/resque-scheduler-2.0.1/lib/resque/scheduler.rb:9:in `<class:Scheduler>': 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 `<module:Resque>'
from /Users/nils/.rvm/gems/ruby-1.9.3-p429/gems/resque-scheduler-2.0.1/lib/resque/scheduler.rb:5:in `<top (required)>'
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 `<top (required)>'
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 <top (required)>'
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 `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
我在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"))
我不知道该怎么做。 :/
答案 0 :(得分:6)
我认为resque_scheduler
与resque -"~> 2.0.0.pre.1"
因为Helper
resque -"~> 2.0.0.pre.1"
模块
点击此处latest和1.x-stable同时查看here
尝试使用1.x-stable分支
希望这个帮助