Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>When new model is created and saved with RESTAdapter its Id property is undefined, because my backend is responsible for id generation. </p> </blockquote> <p>Right, but there is nothing unusual about this - ember expects id generation to be done by the backend.</p> <blockquote> <p>So when I return to grid there is 2 same entities: first - with empty Id (from RESTAdapter cache, I think) and second - with correct Id returned from backend.</p> </blockquote> <p>OK. What do you mean by <em>same 2 entities</em> - surely they are different js objects. Try logging each of them to console like this: </p> <pre><code>console.log(entityOne.toString()); console.log(entityTwo.toString()); </code></pre> <blockquote> <p>Any ideas? </p> </blockquote> <p>There are many things that could cause this to happen. Sounds like somehow you are creating two new records and saving just one of them. Or could be the API response does not match what ember expects, causing an extra record to get created.</p> <ul> <li><p>Try to enable logging on your records, then watch console so you can see what's going on as your model is saved. Hopefully this will give you some insight into when/how the extra record is being created. </p> <p>record.set("stateManager.enableLogging", true)</p></li> <li><p>Inspect browser communication with your api and compare JSON to see if it matches what <a href="http://emberjs.com/guides/models/the-rest-adapter/" rel="nofollow">the ember rest adapter</a> expects. </p></li> <li><p>Post that JSON and the rest of your source code (model definition, etc.) to Stack Overflow, maybe a second set of eyes will help.</p></li> <li><p>Check this post for some other debugging tips: <a href="http://www.akshay.cc/blog/2013-02-22-debugging-ember-js-and-ember-data.html" rel="nofollow">http://www.akshay.cc/blog/2013-02-22-debugging-ember-js-and-ember-data.html</a></p></li> </ul> <blockquote> <p>Maybe it is posiible to disable RESTAdapter cache?</p> </blockquote> <p>RESTAdapter does not maintain a separate cache of model objects. And since you are not trying to do anything special, there should be no need to take a step like that. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload