Head On

Blog by Marcus Ahnve

Rails, PostgreSQL and Time

I just noticed that the mapping between PostgreSQL’s Time Without TimeZone column type maps to Rubys standard Time class. Which gives the following behavior in script/console:

 1 >> t = TimeEntry.find(1)
 2 >> t.time
 3 => Sat Jan 01 23:00:00 +0100 2000
 4 >> t.time = Time.now
 5 => Wed May 09 19:02:07 +0200 2007
 6 >> t.save
 7 => true
 8 >> t = TimeEntry.find(1)
 9 >> t.time
10 => Sat Jan 01 19:02:07 +0100 2000

Am I very anal to find this … sloppy?

blog comments powered by Disqus