title: Mongoid : Embedded documents are saved under the wrong parent
body: <p>When saving documents with 3 levels of nesting, child objects are saved under the wrong parent :</p>
  
  <pre><code>user = User.create
  website = user.websites.create
  post = website.posts.create
  post2 = website.posts.create
  
  post.images.create
  post2.images.create
  
  puts "#{user.to_json}"
  puts "#{user.reload.to_json}"
  </code></pre>
  
  <p>Each post should have an image, that's true on the dirty user object (user.to_json)
  => <a href="https://gist.github.com/vdaubry/cdc465d6d5ef84576830" rel="nofollow">https://gist.github.com/vdaubry/cdc465d6d5ef84576830</a></p>
  
  <p><strong>But when i reload the user all images are embedded under the first post</strong> (user.reload.to_json)
  => <a href="https://gist.github.com/vdaubry/a9c217a467dd9ff9a7fb" rel="nofollow">https://gist.github.com/vdaubry/a9c217a467dd9ff9a7fb</a></p>
  
  <p>Is it a bug or i am missing something obvious ?</p>
  
  <p>Here are the class definition used to reproduce this :</p>
  
  <pre><code>class User
    include Mongoid::Document
    embeds_many :websites
  end
  
  class Website
    include Mongoid::Document
    include Mongoid::Timestamps
    embedded_in :user
    embeds_many :posts
  
  end
  
  class Post
    include Mongoid::Document
    include Mongoid::Timestamps
  
    embedded_in :website
    embeds_many :images
  end
  class Image
    include Mongoid::Document
    include Mongoid::Timestamps
    embedded_in :post
  end
  </code></pre>
  
  <p>My gemfile :</p>
  
  <pre><code>ruby 2.1.2p95
  gem 'rails', '~&gt; 4.1.4'
  gem 'mongoid', '~&gt; 4.0.0'
  </code></pre>