-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
I dont know if this is a bug or not.
I use .as_document to do batch insertion of documents, but it does not generates the created_at field
example:
class Person include Mongoid::Document include Mongoid::Timestamps end person = Person.new person.as_document => {"_id"=>"5359ffe5f12a9ca3c4000001"} Person.collection.insert([person.as_document]) Person.last.created_at => nil
arthurnn should it be fixed with pull request?
I've tried patching the method "as_document" in document.rb
with this:
if new_record? && self.class.include?(Mongoid::Timestamps::Created) set_created_at end
but timeless specs will fail because of the timeless! scope examples