0
I have in my database a column value
with Precision 7 and 2 big decimal type.
In my form I use the simple form and also use the Mask, ie field for input value would look like this:
70.567,54
However, when saving, the controller receives this as a string and automatically converts, and everything after the first point is lost only 70.0.
I tried to use the gsub
withdraw the "." and convert the "," to dot and let it turn to convert to big decimal, but the Rails is not letting move the hash, I tried to use the gem Money
, but it didn’t seem very useful (Or I didn’t quite understand how to use it, it just makes a mistake saying that the value is not a number, of course it comes string and I’m not able to handle it). Maybe I should change the field type in the simple form? But then I wouldn’t show up to Mask.
Does anyone know how I could display Mask and still save the value as and which the user typed in the field (I even thought of using it as a string, but it would take a lot of work later to make calculations of records, sum, average, median etc).