Skip to content

Instantly share code, notes, and snippets.

@MikailCliftov
Created May 17, 2011 15:16
Show Gist options
  • Save MikailCliftov/976663 to your computer and use it in GitHub Desktop.
Save MikailCliftov/976663 to your computer and use it in GitHub Desktop.
wtf part 2
Creating the record:
var record = Rapid.store.createRecord(Rapid.Check, {
guid: '@123'
});
relationA.get('checks').pushObject(record);
... set up an observer on record status
Rapid.store.commitRecords();
the record is created, but relationA.checks points to @123 instead of the storeKey's id (1000)
_createRecords: function(store, storeKeys) {
storeKeys.forEach(function(storeKey) {
var id = store.idFor(storeKey),
recordType = store.recordTypeFor(storeKey),
dataHash = store.readDataHash(storeKey),
fixtures = this.fixturesFor(recordType);
if (!id || (id.indexOf('@') >= 0) ) {
id = this.generateIdFor(recordType, dataHash, store, storeKey);
}
this._invalidateCachesFor(recordType, storeKey, id);
fixtures[id] = dataHash;
store.dataSourceDidComplete(storeKey, null, id);
}, this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment