我正在使用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
我试过Delayed Job Rake Task Failing,但它没有解决我的问题。
有人能描述这里发生了什么吗? 感谢。
答案 0 :(得分:1)
啊!调试DJ是一个痛苦的你知道什么。
此错误消息:
=> Aonymous modules have no name to be referenced by
表示您拼错了其中一个模型。
例如:Categorizatoin
而不是Categorizatoin
。
请仔细阅读DJ中的模特并检查所有模特的拼写。
答案 1 :(得分:1)
我真的不明白为什么DJ无法在2.3版本的rails版本中正常使用gem。确保你已经安装了插件而不是gem,然后按照文档说的那样做。我希望这不会给你anonymous module
问题。