Can someone please tell me the best approach to adding support for
editing MySQL decimal types in rails?
You can for example use long-decimal as ruby-type to match mysql
decimal types with fixed number of digits after the decimal point.
gem install long-decimal
I have a field in the DB that represents currency, and the view will not
let save anything past the decimal place so, 10.99 becomes 10.00
You should be aware that there are other approaches.
There is a Money-type in Ruby, which might be useful for you.
I have some doubts if this is the right way to go, because Money
the currency and the amount, which could be two different fields in the
But it might work in your case.
I would not recommend using Float for monetary stuff, because
it has uncontrolled rounding behaviour.
BigDecimal would be a possibility, but it is not an exact match to
the database type.