Disable Time Zone Conversion for Specified Column

Is it possible to offset the “damage” from rails by writing your own attr reader/writer?

Tried that. Does not work. Rails still does the time zone conversion when persisting to the database.

Example:

class Widget < ActiveRecord::Base

def closed_at=(time)

write_attribute(:closed_at, time)

end

end

in console:

Time.zone = “Arizona”

=> “Arizona”

Time.now.in_time_zone(“Hawaii”)

=> Fri, 19 Oct 2012 06:43:39 HST -10:00

a = Widget.create({closed_at: Time.now.in_time_zone(“Hawaii”)})

a.inspect

=> “#<Widget id: 1, closed_at: “2012-10-19 16:43:48”>”

Rails is still doing the time zone conversion.

Maybe there is a different way to override the attribute writer?