app/view_utils/money_view_utils.rb
# Converts instance of Money to properly formatted and localized string for view purposes
# Replaces spaces with narrow non breaking spaces, we do not want monetary amounts to be split on separate lines
Converts instance of Money to properly formatted and localized string for view purposes
Replaces spaces with narrow non breaking spaces, we do not want monetary amounts to be split on separate lines
Converts instance of Money to properly formatted and localized string for view purposes Replaces spaces with narrow non breaking spaces we do not want monetary amounts to be split on separate lines
def to_humanized(m, locale = I18n.locale)
    return "" if m.nil?
    formatting = currency_opts(locale, m.currency)
    precision = formatting[:digits]
    zero_cents = "0" * precision
    number_to_currency(m.amount,
                       unit: formatting[:symbol],
                       delimiter: formatting[:delimiter],
                       separator: formatting[:separator],
                       format: formatting[:format],
                       precision: precision)
      .tr(" ", "\u202F")
      .gsub("#{formatting[:separator]}#{zero_cents}", "") 
      .encode('utf-8')
  end
def to_humanized ( m , locale = I18n . locale ) return "" if m . nil? formatting = currency_opts ( locale , m . currency ) precision = formatting [ :digits ] zero_cents = "0" * precision number_to_currency ( m . amount , unit : formatting [ :symbol ] , delimiter : formatting [ :delimiter ] , separator : formatting [ :separator ] , format : formatting [ :format ] , precision : precision ) . tr ( " " , "\u202F" ) . gsub ( "#{formatting[:separator]}#{zero_cents}" , "" ) . encode ( 'utf-8' ) end
Converts instance of Money to properly formatted and localized string for view purposes
Replaces spaces with narrow non breaking spaces, we do not want monetary amounts to be split on separate lines
Converts instance of Money to properly formatted and localized string for view purposes Replaces spaces with narrow non breaking spaces we do not want monetary amounts to be split on separate lines
# Explicitly resolve formatting. WebTranslateit resolves # translations to nils which causes an error with number_to_currency # remove cents if they are zero
m
locale