延迟作业(2.1.4) + Rails(3.0.10) 未定义方法“延迟”

发布于 2024-12-22 09:31:31 字数 429 浏览 1 评论 0原文

我将rails应用程序升级到rails(3.0.10)并更新gemelasted_job。我更新了表elaided_job的迁移,但不幸的是方法“.delay”不起作用。

NoMethodError: undefined method `delay' for #<User:0x10394d140>

我没有找到解决方案。我做了:“捆绑安装”,我重新启动了服务器,尝试安装为插件......

你有什么想法吗?

谢谢。

更新:

我解决了问题,但创建了一个文件 config/initializer/delayed_job.rb

require 'delayed_job'
Delayed::Worker.backend = :active_record

I upgrading a rails application to rails(3.0.10) and update the gem delayed_job. I updated my migration for the table delayed_job but unfortunatly the method ".delay" doesn't work.

NoMethodError: undefined method `delay' for #<User:0x10394d140>

I didn't find a solution for that. I did : "bundle install", I restarted the server, tried to instal as plugin...

Do you have any ideas?

Thanks.

UPDATE :

I fixed the problem but created a file config/initializer/delayed_job.rb with

require 'delayed_job'
Delayed::Worker.backend = :active_record

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满天都是小星星 2024-12-29 09:31:31

有时,gems 只是拒绝正确安装。我认为你应该做的是(假设你已经安装了git,否则请转到这里 https://github.com/tobi/ Delayed_job并下载delayed_job作为zip文件)

git clone https://github.com/tobi/delayed_job.git

将他的lib文件夹中的内容放入你的文件夹中。无论你需要使用他的方法,然后

require 'delayed_job'

在这些文件的顶部

做我检查了本教程,它显示了一种在 Rails 3 中设置的方法,

http://www.dixis.com/?p=335

它建议在你的 gemfile 中使用它

gem "delayed_job",  :git => 'git://github.com/collectiveidea/delayed_job.git'

(如果它也不适用于这个,那么尝试和我做的一样,但替换

git clone https://github.com/tobi/delayed_job.git 

git clone https://github.com/collectiveidea/delayed_job.git

告诉我是否有任何效果

Sometimes gems just refuse to install properly. I think what you should do is (assuming you have git installed, otherwise go here https://github.com/tobi/delayed_job and download delayed_job as a zip file)

git clone https://github.com/tobi/delayed_job.git

take what he has in his lib folder and put it in yours. wherever you need to use his methods then do

require 'delayed_job'

in the top of those files

I checked this tutorial, it shows a way to setup in rails 3

http://www.dixis.com/?p=335

it suggests using this in your gemfile

gem "delayed_job",  :git => 'git://github.com/collectiveidea/delayed_job.git'

(if it doesn't work with this either, then try the same thing that i did, but replace

git clone https://github.com/tobi/delayed_job.git 

with

git clone https://github.com/collectiveidea/delayed_job.git

tell me if anything works

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文