javascript - EmberJS Data DS.JSONSerializer vs. DS.JSONAPISerializer -


i have emberjs project 2 model, both seams use different serializers. debugging inside emberjs data i've seen first model class of serializer "ds.jsonapiserializer" , other "ds.jsonserializer". both use same.

i didn't override serializers , respective adapters empty , extend same adapter (generaladapter).

the difference modela objects pushed ember server using request , adapter (using same adapter modelb) whereas modelb pushing store.pushpayload controller (without using adapter).

is feature or bug or totally miss understanding something?

edit:

adapter code:

app.applicationadapter = ds.adapter.extend(ds.buildurlmixin, {     namespace: rabbit.common.baseurl + 'editor-jersey',      defaultserializer: '-rest',      headers: {         accept: 'application/json'     },      findall: function(store, type, sincetoken) {         var adapter = this;         var url = this.buildurl(type.modelname, null, null, 'findall');          return new ember.rsvp.promise(function(resolve, reject) {             ember.$.getjson(url).then(function(data) {                 ember.run(null, resolve, data[type.modelname + "s"]);             }.bind(this), function(jqxhr) {                 jqxhr.then = null; // tame jquery's ill mannered promises                 ember.run(null, reject, jqxhr);             }.bind(this));         }.bind(this));       },      findrecord: function(store, type, id, snapshot) {         var url = this.buildurl(type.modelname, id, snapshot, 'findrecord');          return new ember.rsvp.promise(function(resolve, reject) {             ember.$.getjson(url).then(function(data, status, jqxhr) {                 ember.run(null, resolve, data[type.modelname]);             }, function(jqxhr) {                 jqxhr.then = null; // tame jquery's ill mannered promises                 ember.run(null, reject, jqxhr);             });         });     },      updaterecord: function(store, type, snapshot) {         var adapter = this;         var data = this.serialize(snapshot, { includeid: true });          var url = this.buildurl(type.modelname, snapshot.id, snapshot, 'updaterecord');          return new ember.rsvp.promise(function(resolve, reject) {             ember.$.ajax({                 method: 'put',                 url: url,                 data: json.stringify(data),                 contenttype: 'application/json',                 datatype: 'json'             }).then(function(data) {                 ember.run(null, resolve, data[type.modelname]);             }, function(jqxhr) {                 jqxhr.then = null; // tame jquery's ill mannered promises                 ember.run(null, reject, jqxhr);             });         });     },      createrecord: function(store, type, snapshot) {         var adapter = this;         var data = this.serialize(snapshot, { includeid: true });          var url = this.buildurl(type.modelname, null, snapshot, 'createrecord');          return new ember.rsvp.promise(function(resolve, reject) {             ember.$.ajax({                 method: 'post',                 url: url,                 data: json.stringify(data),                 contenttype: 'application/json',                 datatype: 'json'             }).then(function(data) {                 if (snapshot.isnew) {                     data[type.modelname].isnew = snapshot.isnew;                 }                 ember.run(null, resolve, data[type.modelname]);             }, function(jqxhr) {                 jqxhr.then = null; // tame jquery's ill mannered promises                 ember.run(null, reject, jqxhr);             });         });     } }); 


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -