I have this task with delayed_job:
def any_method
UserMailer.delay(queue: "Email", priority: 3).to_user_when_his_account_is_suspended(user, locale)
end
If I send an email in the form of rails:
def any_method
locale = params[:locale]
UserMailer.to_user_when_his_account_is_suspended(order, locale).deliver
end
The letter is sent in the correct language / language.
However, delayed_job does not recognize the correct language / s. In this case, I get the locale with locale = params[:locale], you can see the following example:
locale = params[:locale]
UserMailer.delay(queue: "Email", priority: 3).to_user_when_his_account_is_suspended(user, locale)
Postal code:
def to_user_when_his_account_is_suspended(user, locale)
@user = user
@locale = locale
mail(:to => @user.email, :subject => t('.user_account_has_been_suspended'))
end
How can I fix this problem?
source
share