Im trying to save date time information to the following field in mongo
key :last_comment_time_cache, DateTime
update_attributes!({:last_comment_time_cache => Time.now})
The data that is being saved is missing the time
"last_comment_time_cache": {
"$date": "2013-03-23T00:00:00.000Z"
}
Any ideas on what im doing wrong?, Thanks Nath
Try changing the field type to Time instead of DateTime. If you watch their Date extension here (Date is the parent of DateTime) they are only taking day,month and year into account to construct the date that will be sent to mongo, that's not the case for their Time implementation.
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