问题
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