Saving a one to many relationship in emberfire
<p>I am trying to save a one to many in emberfire and here is the scenario.</p>

<p>I have a list of territories in the model with each territory that can have many dealers. I also have a list of dealers that are in the model that can have one territory assigned to it via a dropdown in a form.</p>

<p>I have setup the territory dropdown select but I am confused on creating the relationship and then saving it back to firebase.</p>

<p>From what I have read I need to save the child first which would be dealer then push the dealer object into the territory and then save? I've been struggling to write this out in code fairly new with ember.</p>

<p>This is what I have written out so far but doesn't seem to work.</p>

<pre><code>let addTerritory = this.get('model.territory');
addTerritory.get('dealer').addObject(dealer);
dealer.save().then(function() {
   return addTerritory.save();
});
</code></pre>

<p>Any help is appreciated</p>

<p>Thanks!</p>