I have a rails app which deals with product prices from different countries. Storing GBP, and USD is working fine. However, when I start to deal with the CLP (Chilian peso) which has 3 decimal places, it's not storing right.
For example, I am trying to insert 799.990 but when it goes in its storing as 799.99. It is not ideal as there could be a price of 799.99.
I have the price set to t.decimal :price, precision: 19, scale: 4
so this should cover most currencies.
So, my question is there any way to store the price with the trailing 0? Or am I missing something, is there a better way to deal with currencies in rails?
Update: After searching a bit more on StackOverflow, I think this may be an easier way of dealing with currencies.