Reputation: 5534
I am trying to find out a data type of a certain variable (it is a column in a db in RoR application). I would like to format it as a number with 2 decimals, but I want to first find out if it is a string or an integer.
Upvotes: 1
Views: 487
Reputation: 3371
For the format of your 2-decimals number, see this post What is the best method of handling currency/money?
The best way to do is to not change it, and register it directly with rails.
If you have to change a string to a 2-decimal number, create a migration with
my_decimal_number
my_string_number
to my_decimal_number
my_string_number
Upvotes: 3
Reputation: 1929
Upvotes: 2