Ember-Data belongsTo Creation Problems in Beta 10

ember

Just a quick note to help anyone furiously googling. I recently upgraded an application from ember-cli 0.44 to ember-cli 0.1.2, which entialed updating the included ember-data from ember-data 1.0.0-beta.8 to 1.0.0-beta.10. I had a couple of small issues while upgrading - most of which were well answered by the documentation. However, I did run into one mystery issue. This issue is relevant to the RESTAdapter.

On one controller, I have a ‘createPlan’ action which has the following relevant code:

controller
1
2
3
4
5
6
7
8
9
10
11
12
13
14
actions: {
  createPlan: {
    var parentObject = this.get('aSelectedBoundProperty');

    var plan = this.store.createRecord('plan', {
      anAttribute: "value",
      parent: parentObject
    });

    plan.save().then(function(plan) {
      //Do some stuff, including a route transition
    });
  }
}

All pretty standard stuff. In any case, the code worked, except when Ember-Data used the RESTAdapter to persist the record, it did not send a parent: <id> param in the request body. I tried debugging this in every way I could think of; the property was certainly being set on the plan model.

In any case, the fix was to upgrade to ember-data 1.0.0-beta.11. I can confirm that this issue no longer exists in beta.11. However, on the off chance there are people stuck trying to upgrade to beta.10, I hope this will help - since it is no longer an existing bug, I didn’t feel comfortable submitting it to the bug tracker.

Happy coding!


I'm looking for better ways to build software businesses. Find out if I find something.