使用rails 2.3.5延迟作业的任务问题

我正在使用rubygem延迟作业,但无法成功运行rake任务。 我参考了https://github.com/collectiveidea/delayed_job/tree/v2.0。 顺便说一句,我正在使用捆绑软件。

#Gemfile
gem 'delayed_job', '~>2.0.4'
#Rake file
begin
  gem 'delayed_job', '~>2.0.4'
  require 'delayed/tasks'
rescue LoadError
  STDERR.puts "Run `bundle` to install delayed_job"
end

运行rake jobs:work --trace ,它显示下面的错误

rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
** Invoke jobs:work (first_time)
** Invoke merb_env (first_time)
** Execute merb_env
** Invoke environment (first_time)
** Execute environment
** Execute jobs:work
rake aborted!
Anonymous modules have no name to be referenced by
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:585:in `to_constant_name'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:391:in `qualified_name_for'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:104:in `rescue in const_missing'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:94:in `const_missing'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/delayed_job-2.0.6/lib/delayed/tasks.rb:13:in `block (2 levels) in '
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/Users/me/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/gems/rake-0.9.2/bin/rake:32:in `'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/bin/rake:19:in `load'
/Users/me/.rvm/gems/ruby-1.9.2-p180@suga/bin/rake:19:in `'
Tasks: TOP => jobs:work

我尝试了延迟工作耙子任务失败,但它并没有解决我的问题。

任何人都可以描述这里发生了什么? 谢谢。


啊! 调试DJ是一种痛苦,你知道是什么。

此错误消息:

=> Aonymous modules have no name to be referenced by

意思是你拼错了你的一个模型。

例如: Categorizatoin而不是Categorizatoin

因此请在DJ中检查您的模型,并检查您的所有模型上的拼写。


我真的不明白为什么DJ在2.3版的rails版本中无法正常使用gem。确保你已经安装了插件,而不是gem,然后按照文档说的做。 我希望这不会给你anonymous module问题。

链接地址: http://www.djcxy.com/p/41915.html

上一篇: delayed job's task problem with rails 2.3.5

下一篇: parolkar's pfeed plugin