delay_job:从rails 2升级后,属性访问器值未存储在rails 3中的delay_jobs表中 [英] delayed_job: attribute accessor values are not stored in delayed_jobs table in rails 3 after upgrade from rails 2

查看:67
本文介绍了delay_job:从rails 2升级后,属性访问器值未存储在rails 3中的delay_jobs表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在rails2中做到这一点:对于一个作业类,我们为该作业对象设置了一堆attr_accessor方法,并将该对象排队到delay_jobs表中,这些访问器值也存储在该表中。 (我们使用的是delay_job 2.0.3)

How we did this in rails2 was: For a job class we set a bunch of attr_accessor methods for the job object and enqueue the object into delayed_jobs table and those accessor values are stored in the table as well. (we were using delayed_job 2.0.3)

但是在rails3中,即使我们遵循与rails2中相同的过程,attr_accessor值也不会存储在表中。谁能告诉我我们如何使用新的delay_job gem(3.0.3)将访问器值持久化到表中?

But in rails3 even though we follow the same procedure as in rails2, the attr_accessor values are not stored into the table. Can anybody tell me how we persist the accessor values into the table with the new delayed_job gem(3.0.3)?

推荐答案

找到了出了问题的原因在于心理分析器,它仅考虑模型对象的数据库属性,而不考虑实例和类变量。以下是该问题的更精确答案:

Found out that the problem is with the psych parser which takes into consideration only the database attributes for a model object and doesn't take into consideration instance and class variables. Here's a more precise answer for the question: YAML, delayed_job : Psych vs Syck. How to make pysch read attr_accessors for a ruby object

这篇关于delay_job:从rails 2升级后,属性访问器值未存储在rails 3中的delay_jobs表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆