cron job没有在后台工作没有在特定时间发送电子邮件

时间:2014-04-12 12:17:34

标签: ruby-on-rails ruby ruby-on-rails-3 cron whenever

  

schedule.rb

 every 3.minutes do
     runner "Audit.capa_pending_auto_follow_up"           
  end
  

应用程序/邮寄者/ user_mailer.rb

    def capa_pending_auto_follow_up(audit,current_user)
    @audit = audit
    @user = current_user
    mail(:to => @audit.auditee_email, :subject => "CAPA Pending Auto Follow Up")  
  end
  

模型/ audit.rb

def self.capa_pending_auto_follow_up
    @audits_capa_pending = []
    @audits = Audit.all
    @audits.each do |audit|
      audit.findings.each do |finding|
        if finding.status_id == "CAPA Pending" || finding.status_id == ""
          @audits_capa_pending << audit
          break
        end
      end
    end
    @audits_capa_pending.each do |audit|
      UserMailer.capa_pending_auto_follow_up(audit,current_user).deliver
    end
     @user = User.all
      @user.each do |u|
        UsersMailer.weekly_mail(u).deliver
    end
  end
end

这是我的项目中的代码我运行的服务器&#34; rails server&#34; 但我在#34; schedule.rb&#34;中提到的每3分钟没有收到邮件给我。代码中是否有任何错误请帮帮我

0 个答案:

没有答案