Forum: Ruby on Rails Overriding default type mappings of ActiveRecord

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.
Hari Patel (Guest)
on 2006-05-26 22:29
(Received via mailing list)
Hi:

Is there a good way to override the mappings between class variables
and database column type as determined by activerecord ?

I have a column in the database table (postgres) that is declared as
numeric(1000,0) which is an exact precision type. However, activerecord
maps the correspoding class variable to type float which will not work
for me. I'd like to map it to ruby type Bignum which can handle very
large integers.

Any way I can do this by declaring something in the model ?

Thanks !!
Hari Patel (Guest)
on 2006-05-26 22:54
(Received via mailing list)
Hi:

Is there a good way to override the mappings between class variables
and database column type as determined by activerecord ?

I have a column in the database table (postgres) that is declared as
numeric(1000,0) which is an exact precision type. However, activerecord
maps the correspoding class variable to type float which will not work
for me. I'd like to map it to ruby type Bignum which can handle very
large integers.

Any way I can do this by declaring something in the model ?

Thanks !!
This topic is locked and can not be replied to.