Module: Custom::CurrencyHelper
Instance Method Summary
collapse
#collection_for_select, #collection_name_by_id
Instance Method Details
#currency_attribute_name(name) ⇒ Object
12
13
14
|
# File 'app/helpers/custom/currency_helper.rb', line 12
def currency_attribute_name(name)
Currency.attribute_name(cookies[:currency], name)
end
|
#currency_for_label(options = {}) ⇒ Object
7
8
9
10
|
# File 'app/helpers/custom/currency_helper.rb', line 7
def currency_for_label(options = {})
options[:prefix] ||= ', '
"#{options[:prefix]}#{currency_symbol}"
end
|
#currency_symbol ⇒ Object
3
4
5
|
# File 'app/helpers/custom/currency_helper.rb', line 3
def currency_symbol
collection_name_by_id(t('static.currencies', default: ''), cookies[:currency]) || ''
end
|
#num_to_cur(val, iso_code, locale) ⇒ Object
19
20
21
22
|
# File 'app/helpers/custom/currency_helper.rb', line 19
def num_to_cur(val, iso_code, locale)
unit = collection_name_by_id(I18n.t('static.currencies', default: ''), iso_code)
number_to_currency(val, unit: unit, locale: locale)
end
|