Sorry if this is a FAQ but I couldn’t find anything on it:
I want to display a number in an input text_field. I want it to display
with commas, i.e. ‘10,000’. I also want to allow the user to enter
commas in the field. It’s a Float property in the model (could be a
Fixnum instead). If the user enters an invalid number in the form (i.e.
‘a345’) I want to preserve the user’s input and display an error.
What’s the best way to go about this? Do I do my conversions in the
controller? Do I add accessor methods in the model that get and set
strings? (That doesn’t seem very MVC-ish.)