Skip to content

Instantly share code, notes, and snippets.

@kimjoar
Created January 22, 2013 09:45
Show Gist options
  • Save kimjoar/4593391 to your computer and use it in GitHub Desktop.
Save kimjoar/4593391 to your computer and use it in GitHub Desktop.
Nøstede modeller
var Message = Backbone.Model.extend({
parse: function(resp) {
resp.replies = new Messages(resp.replies);
return resp;
},
toJSON: function() {
var attributes = _.clone(this.attributes);
// evt: var attributes = Backbone.Model.prototype.toJSON.call(this)
attributes.replies = attributes.replies.toJSON();
return attributes;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment