Do not use deliver_late

as the delayed job wouldn’t play nicely with the Mailer in lib/ in production
This commit is contained in:
Frederic Merizen 2018-04-11 09:33:06 +02:00
parent 12639646e5
commit 4cc517ccba

View file

@ -3,7 +3,8 @@ namespace :'2018_04_03_attestation_closed_mail_discrepancy' do
Administrateur.includes(:procedures).find_each(batch_size: 10) do |admin|
procedures = admin.procedures.where(archived_at: nil).select { |p| p.closed_mail_template_attestation_inconsistency_state == :missing_tag }
if procedures.any?
Mailers::AttestationClosedMailDiscrepancyMailer.missing_attestation_tag_email(admin, procedures).deliver_later
# Use `deliver_now` because the delayed job cannot find the `Mailers::AttestationClosedMailDiscrepancyMaile` class in production
Mailers::AttestationClosedMailDiscrepancyMailer.missing_attestation_tag_email(admin, procedures).deliver_now!
print "#{admin.email}\n"
end
end