轨道4 + Postgres的=缺少毫秒模型时间戳 [英] Rails 4 + Postgres = Missing milliseconds in model timestamps

查看:190
本文介绍了轨道4 + Postgres的=缺少毫秒模型时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我与 t.timestamps 创建的模型时间戳命令在迁移中。

I have timestamps in my model created with t.timestamps command in the migration.

如果我看直接在数据库中,毫秒被正确地存储。但是,当我获取对象的毫秒不存在。

If I look in the database directly, the milliseconds are stored correctly. But when I fetch the object the milliseconds are not there.

Model.first.updated_at.iso8601(3)
 => "2013-09-28T13:43:58.000Z" 

为什么不从数据库中获取的毫秒?

推荐答案

这个问题是不是Rails的,它是在OS X上的Ruby 2.0.0-P247二进制代码有一个bug:

The problem was not Rails, it was the Ruby 2.0.0-p247 binary on OS X that had a bug:

https://github.com/wayneeseguin/rvm/issues/2189

这篇关于轨道4 + Postgres的=缺少毫秒模型时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆