Displaying 1 result from an estimated 1 matches for "amount_f".
Did you mean:
amount_#
2006 Apr 06
3
Formating Float ActiveRecord attributes in text inputs
...to Float.
Then I use text_field helper to generate text inputs on forms.
Helper takes model object and attribute name and does not provide any
formatting abilities, thus 2.40 is shown as 2.4 which is fine with
floats but does not look good with currency.
I have worked around this issue by adding amount_f attribute to the
model that returns formatted string.
I do not like this "solution" for two reasons:
1. formatting does not belong to models
2. for every Float attribute I am forced to create another read/write
attribute with identical logic.
So this does not look right. What else?
I h...