我得到了一个漂亮的错误:
failed with NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[] - 3 failed attempts
我的控制器:
CardSignup.all.each do |user|
Delayed::Job.enqueue MassEmail.new(user, params[:subject], params[:editor1])
end
质量_电子邮件.rb
class MassEmail < Struct.new(:user, :subject, :message)
def perform
Notifier.deliver_email_blast(user, subject, message)
end
end
_表单.html.haml
- form_tag admin_email_blast_path do
Subject
%br
= text_field_tag 'subject'
%br
Body
%br
= text_area_tag 'message', '', :name => 'editor1'
%br
= submit_tag 'Send Email', :class => 'button'
:plain
<script type="text/javascript">
CKEDITOR.replace( 'editor1' );
</script>
在我使用params[:subject]和params[:editor1]实现延迟的\u作业之前,它工作得很好,所以我必须以某种方式保留它们。
我试过了,没有耽误你的工作MassEmail.new新建甚至没有在我的日志中留下回溯。
我在我的控制台里也试过这个,结果它冻结了。
一定是质量有问题_电子邮件.rb或者是电话
def perform