Rails 3. Why do decimal value strings have values such as # <BigDecimal: 5003750, '0.1E2', 9 (18) >>?
2 answers
This is exactly how Ruby displays BigDecimal objects by default. Not sure why they chose such an ugly format, but hey - maybe some additional information might be useful.
In any case, you can still use them the way you expect - this is just a bit of a weird display. If you want to print BigDecimal in a more normal format, first call to_s , or use puts , which calls to_s for you.
Hope this helps!
+5
Rails automatically returns the decimal value of "row" to the Ruby object that most resembles it. In this case, BigDecimal.
To print this in a good way, you can use "to_s", for example:
puts my_decimal.to_s => "3000000000000000000.0" which should print it better than the ugly version with the class name that you see now.
+3