Module: Custom::CurrencyHelper
Instance Method Summary
collapse
#collection_for_select, #collection_name_by_id
Instance Method Details
#currency_attribute_name(name, currency = nil) ⇒ Object
15
16
17
18
|
# File 'app/helpers/custom/currency_helper.rb', line 15
def currency_attribute_name(name, currency = nil)
currency ||= cookies[:currency]
Currency.attribute_name(currency, name)
end
|
#currency_for_label(options = {}) ⇒ Object
8
9
10
11
|
# File 'app/helpers/custom/currency_helper.rb', line 8
def currency_for_label(options = {})
options[:prefix] ||= ', '
"#{options[:prefix]}#{currency_symbol}"
end
|
#currency_symbol(currency_index = nil) ⇒ Object
3
4
5
6
|
# File 'app/helpers/custom/currency_helper.rb', line 3
def currency_symbol(currency_index = nil)
currency_index ||= cookies[:currency]
Dicts::Currency.find_by_index(currency_index).symbol
end
|
#num_to_cur(val, iso_code, locale) ⇒ Object
23
24
25
26
|
# File 'app/helpers/custom/currency_helper.rb', line 23
def num_to_cur(val, iso_code, locale)
unit = Dicts::Currency.find_by_index(iso_code).symbol
number_to_currency(val, unit: unit, locale: locale)
end
|