ember.js - Returning record(s) after store pushPayload call -
 What is a better way to bring back records after   But, regular         For this reason, it makes sense for   When you use  DS.Store # pushPayload ? This is what I am doing ...   
 var payload = {id: 1, title: "example"} store.pushPayload ('post', payload); Return store.getById ('Post', Payload.Id);    DS With the store # push  you get the record back entered, the only difference between the two, which I can tell, is that  D. Store # Pushpeload  serializes the payload data with the correct serializer.   DS.Store # pushPayload  an  array of objects  is not the only one, and it may contain side-loaded data, it does a complete payload process and requires the route in the payload:   
 {"posts" : [["Id": 1, "title": "title", "comments": [1]}], "comments": [// .. and so on ...]}    ds Store # Push  Expecting a single record is normalized and does not have any side loaded data (note no root key):   
 {"id": 1, "title": "title", "comments": [1]}    push  for the record , But not to return anything for  pushPayload .   pushPayload , then  store.find ('post', 1)  (or  store.getById (' post ', second look of 1)) ) is the way to go, I do not believe there is an  better  method.   
 
  
Comments
Post a Comment