Forum: Ruby on Rails Re: Re: Localized Floats

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6c8168208017c6451244516d7c1be9c5?d=identicon&s=25 jmharvey.9956003 (Guest)
on 2005-11-20 00:47
(Received via mailing list)
I agree, floats aren't suited for monetary values. There's a Currency
class
in my plugin for that, meant to be used with the rails composed_of
directive.
The actual value is stored in the database as an integer.

It's true that
overriding to_s can break code which relies on Numerics formatting a
certain
way.

I don't think this will be an issue for most rails apps, and overriding
to_s makes things a lot easier. If it's a problem in a specific app, one
can
always disable the override.

--- rails@lists.rubyonrails.org wrote:
mannl
wrote:
>
> > I'm developing an app in german, and here in Germany our Float

> > numbers are separated by a comma instead of a dot. I.e.: 150,00
> >
instead of 150.00
>
> Btw:
> Floats are unsuited for monetary values and
some other things, even
> though they are often misused for it. Most of
the time it won't matter,
> but in some cases it will, therefore it's better
to do it right in the
This topic is locked and can not be replied to.