我正在使用 mongoid 5.1,设计,邮戳用于电子邮件发送,我重写了设计方法,如下所示:-
user.rb 模型文件:-
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
现在,我收到“Devise::RegistrationsController#create 中的 ActiveJob::SerializationError”错误,如何重写 ActiveJob 来删除此错误,因为我是 Rails 新手,所以我对重写没有任何想法源代码,如果提到猴子修补或源代码覆盖的正确技术,我将不胜感激。谢谢,祝您编码愉快。
最佳答案
将 include GlobalID::Identification
添加到发送到邮件程序的任何模型中。 deliver_later
需要一个 ID 才能从数据库中再次检索模型。
http://edgeguides.rubyonrails.org/active_job_basics.html#globalid
关于mongoid - 如何重写 ActiveJob 以防止序列化错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35554457/