我正在努力获得Rails 3测试版中的时区支持,我想知道它是否是一个错误或者我是否做错了什么.他是问题所在:
> Time.zone = 'Madrid' # it is GMT+2
=> "Madrid"
> c = Comment.new
=> #<Comment id: nil, title: "", pub_at: nil>
> c.pub_at = Time.zone.parse('10:00:00')
=> Mon, 31 May 2010 10:00:00 CEST +02:00
> c.save
> c
=> #<Comment id: 3, title: "", pub_at: "2010-05-31 08:00:00">
> c.reload
=> #<Comment id: 3, title: "", pub_at: "2010-05-31 08:00:00">
ruby-1.8.7-p249 > c.pub_at
=> Mon, 31 May 2010 13:00:00 CEST +02:00
正如您所看到的,pub_at属性正确存储在数据库中,但是当它被检索时,它会增加3个小时,我怀疑这是因为它正在使用GMT-3中的本地计算机时区.
rails 2.3.5中的相同命令序列完美运行.
任何艰难的?我应该报一张票吗?