Andy_Koch
(Andy Koch)
1
anybody know how one overrides the default AR attribute methods?
ex.
>> c = Group
>> c.id
=> 3.0
>> c.id.to_i
=> 3
reason is, I'm using Firebird DB which some tables return decimals for id, I'd like to override that behavior so calling "c.id" returns an integer
>> c = Group
>> c.id
=> 3
thanks
Andy_Koch
(Andy Koch)
2
Andy Koch wrote:
anybody know how one overrides the default AR attribute methods?
ex.
>> c = Group
>> c.id
=> 3.0
>> c.id.to_i
=> 3
reason is, I'm using Firebird DB which some tables return decimals for
id, I'd like to override that behavior so calling "c.id" returns an integer
>> c = Group
>> c.id
=> 3
thanks
>
dang, it always happens...
flipped open Obie's Rails way and got it..
def id
read_attribute(:id).to_i
end
def id
self[:id].to_i
end