Module: L10n::Forms::FormBuilder

Defined in:
lib/l10n/forms.rb

Instance Method Summary collapse

Instance Method Details

#amount_field(field, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/l10n/forms.rb', line 5

def amount_field(field, options = {})
  options = objectify_options(options)
  format_options = options.extract!(:locale, :precision, :significant, :separator, :delimiter, :strip_insignificant_zeros)
  value = L10n.number_to_rounded(object.public_send(field), format_options)
  options[:value] = value
  options[:class] = "#{options[:class]} amount_field"
  text_field(field, options)
end