Delayed_Jobs不会刷新

时间:2010-10-11 16:00:45

标签: ruby-on-rails ruby debugging caching actionmailer

我之前设置了一个邮件程序,可以将电子邮件发送给所有用户帐户。但现在我正在尝试调试它。所以我完全彻底搞砸了它,仍然向我发送电子邮件。

我绝对没有理由或理解为什么。疯狂! :d

控制器

def org_blast_send
  Delayed::Job.enqueue OrgBlast.new(params[:subject], params[:editor1])
  redirect_to org_blast_admin_email_blast_path
end

org_blast.rb

class OrgBlast < Struct.new(:subject, :editor1)
  def perform
    # You see? There is absolute nothing here but it still sends an email.
    # However, if I rename this file, the website fails looking for it.
  end
end

notifier.rb

def org_blast(org, subject, message)
  subject subject
  from NOTIFIER_EMAIL
  recipients org.users.first.email
  sent_on Time.zone.now
  body :user => org.users.first.first_name + ' ' + org.users.first.last_name, :message => message
  content_type  "text/html"
end

1 个答案:

答案 0 :(得分:3)

如果您在本地运行delayed_jobs,则必须停止并重新启动,否则它将尽管代码执行上次启动时代码中的操作。

>> script/delayed_job stop
>> script/delayed_job start