我的报告控制器中有这个方法:
def send_status
date = Date.today
reports = current_user.reports.for_date(date)
ReportMailer.status_email(current_user, reports, date).deliver
reports.update_all(:sent_mail => true)
head :ok
rescue => e
render text: e.message, status: :bad_request
end
发送此状态时我无法提出任何请求,因此我使用了延迟作业,替换
ReportMailer.status_email(current_user, reports, date).deliver with ReportMailer.status_email(current_user, reports, date).send_later(:send_status)
但我收到 400 错误的交货请求。有帮助吗?谢谢!