Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-3446

created_at nil for embedded documents

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Associations, Persistence
    • None

      Is this a bug or is this a known limitation that could be documented? Seems like it would affect many simple use cases like embedded user preferences.

       
      Mongoid::VERSION #=> "3.1.6"
      
      class Parent
        include Mongoid::Document
        include Mongoid::Timestamps
        embeds_one :child, cascade_callbacks: true
      
        before_create :build_child
      end
      
      class Child
        include Mongoid::Document
        include Mongoid::Timestamps
        embedded_in :parent
      end
      
      parent = Parent.create
      child = parent.child
      child.persisted? #=> true
      child.created_at #=> nil
      

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            jtescher jtescher
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: