T
T
TSobolev2019-09-03 05:07:14
Ruby on Rails
TSobolev, 2019-09-03 05:07:14

How to convert to number in Rails simple_form_for form?

Hello.
There is such a code:
= f.input :amount, required: true, label: 'Сумма'
Now, if you enter the value 100.12 in this field, then the numbers after the decimal point are discarded. If 100.12 - then everything is ok. How can I override the format of the field so that when both 100.12 and 100.12 are entered for all system fields within the Rails application (there are a lot of such fields), this element ("input") converts the value to a float?
There is a suspicion that you need to dig here:
config/initializers/simple_form.rb
config/initializers/simple_form_bootstrap.rb
config/locales/simple_form.en.yml
But I could not find a specific implementation.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question