Skip to content

Instantly share code, notes, and snippets.

@jberthet
Created December 30, 2013 19:49
Show Gist options
  • Select an option

  • Save jberthet/8187113 to your computer and use it in GitHub Desktop.

Select an option

Save jberthet/8187113 to your computer and use it in GitHub Desktop.
// Model definition code
Essaissprout.A = SC.Record.extend({
aProp: SC.Record.attr(String),
bLink: SC.Record.toOne('Essaissprout.B', {inverse: 'aLink'})
});
Essaissprout.B = SC.Record.extend({
bProp: SC.Record.attr(String),
aLink: SC.Record.toMany('Essaissprout.A', {inverse: 'bLink'})
});
// Test code I run into Firefox
ES = Essaissprout;
dataHash = {bProp: "Hello I'm B", aLink: []};
tmpId = SC.guidFor(dataHash);
bRecord = ES.store.createRecord(ES.B, dataHash, tmpId);
ES.store.commitRecord(ES.B, null, bRecord.get('storeKey'));
dataHash = {aProp: "Hello I'm A", bLink: bRecord};
tmpId = SC.guidFor(dataHash);
aRecord = ES.store.createRecord(ES.A, dataHash, tmpId);
ES.store.commitRecord(ES.A, null, aRecord.get('storeKey'));
// After that, if I check what is in bRecord, the attribute "aLink" is still empty ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment