延迟作业(2.1.4) + Rails(3.0.10) 未定义方法“延迟”
我将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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有时,gems 只是拒绝正确安装。我认为你应该做的是(假设你已经安装了git,否则请转到这里 https://github.com/tobi/ Delayed_job并下载delayed_job作为zip文件)
将他的lib文件夹中的内容放入你的文件夹中。无论你需要使用他的方法,然后
在这些文件的顶部
做我检查了本教程,它显示了一种在 Rails 3 中设置的方法,
它建议在你的 gemfile 中使用它
(如果它也不适用于这个,那么尝试和我做的一样,但替换
为
告诉我是否有任何效果
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)
take what he has in his lib folder and put it in yours. wherever you need to use his methods then do
in the top of those files
I checked this tutorial, it shows a way to setup in rails 3
it suggests using this in your gemfile
(if it doesn't work with this either, then try the same thing that i did, but replace
with
tell me if anything works