I'd like to override the typecasting that ActiveRecord is doing to my datetime fields when using a finder like .first or .all but it doesn't seem to be working the way I thought it would.. I was expecting the override to return the datetime_before_type_cast like it works when I access the field directly in the bottom example.
In my model I have what I thought would override the attribute:
def datetime
self.datetime_before_type_cast
end
SomeModel.first
#<SomeModel datetime: "2010-01-20 12:00:00"> #shouldn't it be "2010-01-20 12:00:00.123"?
SomeModel.first.datetime
"2010-01-20 12:00:00.123"