Some code in my current project validates date time format using
_before_type_cast method. But after adding "config.time_zone = “UTC” in
environment.rb, we can’t get string raw values of some date time columns
using _before_type_cast.
for example,
p = Person.new(:name => ‘sean’, :birthday => ‘1989-01-23’)
p.birthday_before_type_cast
Mon, 23 Jan 1989 00:00:00 UTC 00:00
p.birthday_before_type_cast.class
=> ActiveSupport::TimeWithZone
now birthday_before_type_cast returns value of type:
“ActiveSupport::TimeWithZone”.
Is there a method to get the raw value of date time column in this case?
By the way, is this a bug of rails 2.1.0 or the right behavior?
Thanks.