5
我想知道为什么mongoid返回字符串时,我想读出created_at日期?我的问题是:当我要打印日期这样Mongoid:时间戳类型的字符串?
<% @app.created_at.strftime("%m/%d/%y") %>
Rails是养
undefined method `getlocal' for "Wed, 11 Jul 2012 02:39:24 -0400":String
错误。那么我能做些什么来让mongoid以Time对象的形式返回日期?
在此先感谢!
如何created_at被设置? – 2012-07-11 07:26:32
created_at由MongoID自动设置。控制台告诉我,created_at类是=> ActiveSupport :: TimeWithZone – Tronic 2012-07-11 07:42:34
显示您的模型定义。你有'field:created_at'声明吗? – 2012-07-11 16:37:29