jeudi 9 juillet 2015

Ember-data get "belongsTo" attr (id) from model without resolving the actual object

I want to get a models attribute (id) "belongsTo" without forcing a server call or resolving the object. I got memberships having a user. The most users are loaded and so I only want to make a server call for some of the users. I updated recently to ember-data 1.13.4 and my old version is't working anymore.

Memberships:

user: DS.belongsTo('user', { async: false }),

Until now I did this to check if a users was already in the store:

if (this.store.peekRecord('user', parseInt(membership._internalModel._data.user)) === null)
      return false;

But with the new Ember-Data update the _data does not include anymore the belongsTo - Ids.

Ends up in this on progress:

Error while processing route: workgroups Assertion Failed: You looked up the 'user' relationship on a 'membership' with id 21 but some of the associated records were not loaded.

I really really appreciate every help on this.

Thx

Aucun commentaire:

Enregistrer un commentaire