acts_as_priceable vs. dollars_and_cents
Posted by theBlatherskite Tue, 29 Aug 2006 23:11:00 GMT
Say you’ve got a rails project, and you want it to interact with money in some way (probably not an unreasonable supposition). For this entry, we’ll pretend you’re working with a price attribute. If you map price to a database column of type decimal, it’ll come out as a float in ruby and you’ll end up with all sorts of nasty rounding errors (example, and some explanations).
I spent some time today looking for a simple solution to let me add prices together (you might think that’d be a basic capability in the easy-on-the-developer rails universe… but apparently you’d be wrong).
Read more...