Overriding default type mappings of ActiveRecord


#1

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 !!


#2

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 !!