i'm wondering why mongoid is returning a String when i want to read out the created_at date? my problem is: when i want to print the date like this
<% @app.created_at.strftime("%m/%d/%y") %>
rails is raising a
undefined method `getlocal' for "Wed, 11 Jul 2012 02:39:24 -0400":String
error. so what can i do to get mongoid to return the date as Time object?
thanks in advance!
Does your model contain a
include Mongoid::Timestamps
If it is, someObject.created_at.class should return Time
See http://mongoid.org/en/mongoid/docs/extras.html#timestamps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With