How to to debug what ember data does after save, update and create?


#1

Hi all,

I’m new to ember.

I’m having problems with my models not being updated after a save, create or update using Ember Data.

I can see in console under Network that the restapi returns updated information, but I have to do a GET (reload) to get the new id etc. But that seems kinda silly as the data is sent back during a save, create etc.

For example, if I in the ‘then()’ function write out the object passed to me by ember data and it has not updated with the server data, for example the id.

var newStudentPlanTemplate = this.store.createRecord('studentPlanTemplate');
var self = this;
newStudentPlanTemplate.save().then(function(studentPlanTemplate){
    console.log("studentPlanTemplate: " + studentPlanTemplate);
});

outputs

studentPlanTemplate: <App.StudentPlanTemplate:ember613:null>

I can’t really create a JSBin with the example as the restapi is running locally on my machine.

So I was wondering if there is a smart way for me to debug why my objects arn’t updated? What do you guys do to debug?

I tried overriding the Rest adapter createRecord, saveRecord etc, but that didn’t really help.

I’m using

DEBUG: Ember      : 1.5.1 ember-1.5.1.js:3521
DEBUG: Ember Data : 1.0.0-beta.7+canary.ab589b32 ember-1.5.1.js:3521
DEBUG: Handlebars : 1.1.2 ember-1.5.1.js:3521
DEBUG: jQuery     : 1.10.2 

Any hints?

Many thanks,

William