This is how normally timezones are set in Rails
(application.rb)
config.time_zone = 'Eastern Time (US & Canada)'
config.active_record.default_timezone = 'Central Time (US & Canada)'
When I did that, what happens is: I am able to see the created_at/updated_at in database but when I get the Model object and call "created_at" property to get the time, it is empty.
example: in my Database I have:
<Post id: 4,
author: "Anonymous", title: "Test",
text: "Test Title",
created_at: "2014-08-26 21:00:25",
updated_at: "2014-08-26 21:00:25">
But when I grab the post like
mypost = Post.find(4)
mypost.created_at #this is empty
mypost.updated_at #this is empty
mypost.title #text
mypost.author #Anonymous
I know even if I use the default time zone in Active Record, it converts the time to my local timezone automatically but It is so annoying to use db with different timezone. Does anybody have any idea about it?
Thanks.