Skip to content

Instantly share code, notes, and snippets.

@svparijs
Created December 14, 2012 19:14
Show Gist options
  • Save svparijs/4287861 to your computer and use it in GitHub Desktop.
Save svparijs/4287861 to your computer and use it in GitHub Desktop.
App.Person = DS.Model return NULL when finished loading.
App.Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
fullName: function() {
return this.get('firstName') + ' Test ' + this.get('lastName');
}.property('firstName', 'lastName'),
didLoad: function() {
console.log(this.get('firstName') + this.get('lastName') +" finished loading.");
},
isError: function() {
console.log('Error');
}
});
App.store = DS.Store.create({
revision: 10,
adapter: DS.RESTAdapter.create({ bulkCommit: false, namespace: 'rest' })
});
App.store.load(App.Person, {
id: 1,
firstName: "Peter",
lastName: "Wagenet"
});
App.store.loadMany(App.Person, [{
id: 2,
firstName: "Erik",
lastName: "Brynjolsofosonsosnson"
},
{
id: 3,
firstName: "Yehuda",
lastName: "Katz"
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment