On Nov 13, 1:35 pm, "Jeremy Kemper" <[EMAIL PROTECTED]> wrote:
> On 11/13/07, knightsc <[EMAIL PROTECTED]> wrote:
>
> > My question is with assert_kind_of Integer, m1.world_population. Why
> > would world_population be an integer. It seems like this test makes an
> > assumption about how a particular database stores the actual data type
> > internally. To me when defining a field as decimal(10) or lets say
> > numeric(10) both of these really should be of kind BigDecimal since
> > that's what the database field is stored as it's just that the
> > BigDecimal object should have no numers after the decimal point.
>
> numeric with no decimal digits are typically used for big integers, so
> mapping them to Ruby big integers is natural and expected. I think
> it's a good convention.
>
> jeremy

So should the Fireruby driver be modified to return the base type that
the database is actually using to store a field? This isn't always
going to be the same for every database for instance a decimal(2)
might be stored as something small in mysql and in turn a test is
expecting a FixNum but in Firebird this field is really stored as an
integer so even If I returned the base type it still might not match
what the test is expecting. Do you see what I mean? I think you're not
really suppose to be seeing the underlying types from a database if a
field is declared as NUMERIC or DECIMAL then the result should be a
BigDecimal it just so happens that maybe that BigDecimal has precision
and maybe not.

-Scott


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" 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-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to