【发布时间】:2014-12-13 13:55:09
【问题描述】:
主要问题是我的电子邮件没有发送
我使用带有“delayed_job_mongoid”的 rails 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.)
所以我延迟的工作无法访问 co ContactForm.class 或应该呈现的文件
我应该在我的 initializers/delayed_job.rb 中以某种方式要求它吗?我怎样才能做到这一点? ContactForm.class 在模型目录中
【问题讨论】:
-
整个错误信息是什么?
DocumentNotFound表示找不到文档,而不是类。这表明您的 DJ 的_id无效或缺失。 -
@muistooshort 是什么意思?
-
这意味着当你
UserMailer.delay.question(@question)时@question.id是54418fe3c4bff8bb17000008但是当延迟作业运行时没有ContactForm和id。那么是什么破坏了ContactForms?
标签: ruby-on-rails ruby-on-rails-3 mongoid delayed-job