I have problem in my application with using helpers in email templates. In my application I have implemented "money-rails" to handle payment in other currencies.I have the following helper:
module CurrencyHelper
# overriding std rails helper to use 'money' gem methods
def number_to_currency(money, options = {})
return '-' unless money
currency = options.fetch(:currency, current_currency)
date = options.fetch(:date, nil)
should_reload = if date && !money.currency.eql?(currency)
ExchangeRatesManager.new(date: date).call
end
money_in_currency = money.exchange_to(currency)
ExchangeRatesManager.new.call if should_reload # should rollback to current exchange rates
humanized_money_with_symbol(money_in_currency)
end
end
And now I use it in my email mailers templates. When I send mail not through delayed_job everything is ok:
UserMailer.reservation_confirmation_link(@reservation).deliver
but when I send email through delayed_job:
RentalOfficeMailer.delay.reservation_summary(@reservation)
it not load this overwrited number_to_currency method and it not shows me proper currency.
Thank's in advance for any help.