Use the default locale when sending mails to suppliers

This commit is contained in:
Patrick Gansterer 2019-01-23 23:00:33 +01:00
parent d925533366
commit 63e1541aa3
2 changed files with 9 additions and 1 deletions

View file

@ -125,6 +125,12 @@ class Mailer < ActionMailer::Base
end
end
def self.deliver_now_with_default_locale(&block)
I18n.with_locale(FoodsoftConfig[:default_locale]) do
self.deliver_now &block
end
end
def self.deliver_now
message = yield
message.deliver_now

View file

@ -266,7 +266,9 @@ class Order < ApplicationRecord
end
def send_to_supplier!(user)
Mailer.order_result_supplier(user, self).deliver_now
Mailer.deliver_now_with_default_locale do
Mailer.order_result_supplier(user, self)
end
update!(last_sent_mail: Time.now)
end