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. Thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gabe da Silveira
2007-Jun-23 00:54 UTC
Re: object class for default mysql :decimal columns
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 <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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. > > Thanks! > > -- > Posted via http://www.ruby-forum.com/. > > > >-- Gabe da Silveira http://darwinweb.net --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---