delayed_job: attribute accessor values are not stored in delayed_jobs table in rails 3 after upgrade from rails 2

主宰稳场 提交于 2019-12-11 23:19:05

问题


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)

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)?


回答1:


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



来源:https://stackoverflow.com/questions/13122969/delayed-job-attribute-accessor-values-are-not-stored-in-delayed-jobs-table-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!