title: How to make embedded hasMany relationships work with ember data
body: <p>I can't get <code>embedded</code> <code>hasMany</code> to work correctly with ember data. </p>
  
  <p>I have something like this</p>
  
  <pre><code>App.Post = DS.Model.extend({
    comments: DS.hasMany('App.Comment')
  });
  
  App.Comment = DS.Model.extend({
    post: DS.hasMany('App.Post'),
    name: attr('string')
  });
  </code></pre>
  
  <p>And my API returns the following for <code>GET /post</code>:</p>
  
  <pre><code>[
    {
     id: 1
     comments: [{name: 'test'}, {name: 'test2'}]
    },
    ...
  ]
  </code></pre>
  
  <p>I need to send this with <code>POST /post</code>:</p>
  
  <pre><code>[
    {
      comments: [{name: 'test'}, {name: 'test2'}]
    },
    ...
  ]
  </code></pre>
  
  <p>I want to work with Ember models and have them make the appropriate requests:</p>
  
  <pre><code>var post = App.store.createRecord(App.Post, hash_post_without_comments);
  post.get('comments').createRecord(hash_comment);
  
  App.store.commit(); // This should call the POST api 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>var posts = App.store.find(App.Post); // This should call the GET api 
  </code></pre>
  
  <p>When I try something like <code>post: DS.hasMany('App.Post', {embedded: true})</code>, the GET is working but the POST is trying to make a POST for the two records not only the parent one.</p>
  
  <p>EDIT : My Real use case </p>
  
  <p>1- I've just built ember data from master</p>
  
  <p>2- My adapter: RESTAdapter</p>
  
  <p>3- The serializer: JSONSerializer</p>
  
  <p>4- I added</p>
  
  <pre><code>App.MyAdapter.map('App.Join', {
      columns: { embedded: 'always' }
  });
  </code></pre>
  
  <p>5- My Models are:</p>
  
  <pre><code>App.Join = DS.Model.extend({
      rowCount: DS.attr('number'),
      columns: DS.hasMany('App.JoinColumn'),
  });
  
  App.JoinColumn = DS.Model.extend({
      join: DS.belongsTo('App.Join')
  });
  </code></pre>
  
  <p>6- When:</p>
  
  <pre><code>var a = App.Join.find(1);
  a.get('columns').createRecord({});
  App.store.commit();
  </code></pre>
  
  <p>a POST for joincolumn is sent and the parent is not dirty</p>
  
  <p>What am i missing?</p>