The problem is that you're defining this method (to_fl) on Float, while AR is returning you a BigDecimal. Have you tried defining the method in the correct class?
You don't appear to really want the "float value"; for large numbers, it will lose a lot of precision (and thus the advantage of storing in a :decimal column). --Matt Jones On Jun 3, 1:53 am, Craig White <[email protected]> wrote: > yeah, I'm sort of stuck in a rails 1.2.x time warp and am struggling > with a bunch of the changes in 2.3.x - thus, it wasn't really the big > decimal thing of mysql that was the problem. > > I forgot about to_f because frankly, I never used it. I primarily am > concerned with view code here so I had just stuck that code to extend > the Float class (which worked so well in 1.2.x)... > > class Float > def to_fl(digits) > sprintf("%.#{digits}f",self) > end > end > > and I could get a fixed number of digits whenever I wanted. Apparently > this is like a very ineffective way to go about things in 2.3.x and to_f > gives me whatever decimal places it believes are significant so I'm sort > of trying to figure out how to locate the magic genie again. > > Craig > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

