Ruby on Rails - How to migrate code from float to decimal?
Posted
by
user1723110
on Server Fault
See other posts from Server Fault
or by user1723110
Published on 2012-11-06T16:34:03Z
Indexed on
2012/11/06
17:04 UTC
Read the original article
Hit count: 284
So I've got a ruby on rails code which use float a lot (lots of "to_f"). It uses a database with some numbers also stored as "float" type.
I would like to migrate this code and the database to decimal only. Is it as simple as migrating the database columns to decimal (adding a decimal column, copying float column to decimal one, deleting float column, renaming decimal column to old float column name), and replacing "to_f" with "to_d" in the code? Or do I need to do more than that?
Thanks a lot everyone Raphael
© Server Fault or respective owner