Forum: Ruby on Rails object class for default mysql :decimal columns

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5e75f4b81923cd04a5c8fffa290be92e?d=identicon&s=25 Carl Johnson (carlivar)
on 2007-06-23 02:50
I've noticed some strange behavior while debugging some problems in the
acts_as_rated plugin and Rails 1.2.3 with mysql.

In a migration or schema, a :decimal column that specifies :scale is
returned as a BigDecimal object in Rails. That's good.

Specifying just :decimal however without :scale or :precision will
return a Fixnum object in Rails. That's bad and inconsistent. For
:decimal data, developers would expect to be able to use methods like
nan? that only work for numeric classes such as Float or BigDecimal.
Columns of type :decimal should return a consistent object class no
matter what the scale or precision defined.

Can anyone confirm this or shed some light? I hesitate to submit a Rails
bug because I have no idea how to go about writing a test for this
within Rails.

6e9db38e16957cc51cf9cee9de399249?d=identicon&s=25 Gabe da Silveira (Guest)
on 2007-06-23 02:54
(Received via mailing list)
I don't have time to confirm right now, but go ahead and put the bug
in.  The worst that happens is they close it.

On 6/22/07, Carl Johnson <> wrote:
> nan? that only work for numeric classes such as Float or BigDecimal.
> Posted via
> >

Gabe da Silveira
This topic is locked and can not be replied to.