Skip to content

Instantly share code, notes, and snippets.

@andreisoare
Created July 26, 2013 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreisoare/6092742 to your computer and use it in GitHub Desktop.
Save andreisoare/6092742 to your computer and use it in GitHub Desktop.
didCreateRecord: function(record, data) {
var rootKey = get(record.constructor, 'rootKey'),
primaryKey = get(record.constructor, 'primaryKey'),
dataToLoad = rootKey ? data[rootKey] : data;
record.set(primaryKey, dataToLoad[primaryKey]); // setting the id returned by the server
record.load(dataToLoad[primaryKey], dataToLoad);
record.didCreateRecord();
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment