帮助安装delayed_job
我正在尝试使用collectiveidea的delayed_job gem 安装说明包括
Rake tasks are not automatically loaded from gems, so you’ll need to add
the following to your Rakefile:
begin
require 'delayed/tasks'
rescue LoadError
STDERR.puts "Run `rake gems:install` to install delayed_job"
end
我的 Rakefile 在哪里?什么是 Rakefile?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我对rails 3.1和collectiveidea-delayed_job也有同样的问题。
在初始化程序中添加
Delayed::Worker.backend = :active_record
后,我收到错误没有这样的文件来加载 --delayed/backend/active_record (LoadError)
对我来说,解决方案是在 gemfile 中添加
gem 'delayed_job_active_record'
,如建议的此处I had the same problem with rails 3.1 and collectiveidea-delayed_job.
Once I added
Delayed::Worker.backend = :active_record
in the initializer I got the errorno such file to load -- delayed/backend/active_record (LoadError)
The solution for me was to add
gem 'delayed_job_active_record'
in the gemfile, as suggested here我有同样的问题,并将该代码放在 lib/tasks 目录中的elasted_job.rake 中。它有效,但现在它说:
现在出了什么问题?
更新:我刚刚收到布兰登的邮件答复:
最新版本中存在一个错误,在使用 rake 任务时它无法正确初始化。如果您在 config/initializers 中创建一个文件并将以下内容放入其中,则错误应该消失:
I have the same problem and put that code in delayed_job.rake in the lib/tasks directory. It works, but now It say's:
What is wrong now?
UPDATE: I just got a mail answer from Brandon:
Theres a bug in the latest version where it doesn't get properly initialized when using the rake task. If you create a file in config/initializers and put the follow in it, the error should go away:
Rakefile 是一个用于配置rake,一个 Ruby 构建工具(有点像 make,但全部用 Ruby 编写)。在 Rails 项目中,顶部项目目录中有一个名为 Rakefile 的文件,您可以在其中插入此代码。
或者,您可以将文件添加到 lib/tasks 目录中(例如名为elasted_job.rake)并将代码放入其中。文件名并不重要,只要
The Rakefile is a file that is used to configure rake, a Ruby build tool (sort of like make, but all in Ruby). In a Rails project, there is a file in the top project directory named Rakefile where you can insert this code.
Alternatively, you can add a file into the lib/tasks directory (for example named delayed_job.rake) and put the code into there. The name of the file is not important as long as