Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
hacked Backbone model
/** WTF MAYNE **/
Admin.User = Backbone.Model.extend({
idAttribute: '_id',
setAction: function (action) {
this.action = action;
},
getAction: function () {
if (!this.action) return '';
var action = this.action;
this.action = null;
return '/'+action;
},
url: function () {
return Admin.API + (this.isNew() ? '/users/' : '/users/' + this.get('_id') + this.getAction());
},
parse: function (data) {
if (data.user) return data.user;
return data;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.