1
ruby-1.9.2-p0 > SalesData.last
=> #<SalesData id: 196347, created_at: "2011-04-05 18:53:15", updated_at: "2011-04-05 18:53:15"> 
ruby-1.9.2-p0 > SalesData.last.created_at
=> Tue, 05 Apr 2011 20:53:21 CEST +02:00 

application.rb:

config.time_zone = 'Copenhagen'

I don't get it - anyone?

jriff
  • 1,947
  • 3
  • 23
  • 33

1 Answers1

6

I assume you're asking why the created_at datetimestamps appear to differ. In short, they don't.

Rails always stores datetimes in UTC, converting them to your configured timezone on the fly while loading the record. I don't know exactly when that conversion happens, but I'm betting you're just seeing those two states.

bioneuralnet
  • 5,283
  • 1
  • 24
  • 30