0
主要的問題是,我的郵件沒有發送DJ不反序列化一個未保存的ActiveRecord模型的解決方法
我用「delayed_job_mongoid」軌3.2.19
要發送電子郵件,我使用
UserMailer.delay.question(@question)
我的數據庫中有註冊的延誤工作,但有錯誤
Mongoid::Errors::DocumentNotFound, class: ContactForm, primary key:
54418fe3c4bff8bb17000008 (Problem: Document(s) not found for class
ContactForm with id(s) 54418fe3c4bff8bb17000008.
Summary:
When calling ContactForm.find with an id or array of ids, each
parameter must match a document in the database or this error
will be raised. The search was for the id(s):
54418fe3c4bff8bb17000008 ... (1 total) and the following ids were not found:
54418fe3c4bff8bb17000008.
Resolution:
Search for an id that is in the database or set the Mongoid.raise_not_found_error
configuration option to false, which will cause a nil to be returned instead of
raising this error when searching for a single id, or only the matched documents
when searching for multiples.)
所以我的延遲作業無法訪問合同ContactForm.class或應該呈現的文件
我是否需要它在我的初始化程序/ delayed_job.rb?我怎樣才能達到目的? ContactForm.class在模型目錄中
什麼是整個錯誤消息? 'DocumentNotFound'表示找不到*文檔*,而不是類。這表明你的DJ有一個無效或缺少'_id'。 – 2014-10-17 22:59:42
@ muistooshort這是什麼意思? – hodiecode 2014-10-17 23:17:16
這意味着當'UserMailer.delay.question(@question)'時,'@ question.id'是'54418fe3c4bff8bb17000008',但當延遲的作業運行時,'id'沒有'ContactForm'。那麼是什麼破壞了ContactForm呢? – 2014-10-18 01:48:45