You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).
The 'pg' driver intentionally does not do any typecasting for any field. See [[http://wiki.postgresql.org/wiki/Driver_development|the PostgreSQL wiki page on Driver Development]] for the reasons behind the design decisions.
Original comment by lazarius (Bitbucket: lazarius, GitHub: lazarius).
I agree with the wiki that you need to provide a way to access to the "raw" data, but is not that the function of "read_attribute_before_type_cast" instead of "read_attribute" since it brake the model behavior if you use another driver (e.g. mysql2) ?
Original comment by Michael Granger (Bitbucket: ged, GitHub: ged).
That may be, but read_attribute is not implemented in the pg gem, it's implemented by whatever layer you're using on top of it. I'd guess ActiveRecord based on the fact that you're using Rails. You can't "use another driver" with pg, because it is the driver. Does that make sense?
I suspect you really want to be filing a ticket with whoever maintains ActiveRecord's PostgreSQL adapter.
Original report by lazarius (Bitbucket: lazarius, GitHub: lazarius).
I have an issue when I use 'read_attribute' on a timestamp attribute of my model, it return a String object instead of a DateTime object.
def start_date
read_attribute(:start_date)
end
event.startdate => "2012-02-06 07:00:00" #String
instead of Mon, 06 Feb 2012 07:00:00 0000 # DateTime
Using Rails 3.2.2 and Postgres 9.1
The text was updated successfully, but these errors were encountered: