Created
February 22, 2013 00:42
-
-
Save kn0ll/5009849 to your computer and use it in GitHub Desktop.
Brainy collection using a class method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'backbone' | |
], function(Backbone) { | |
return Backbone.Collection.extend({ | |
url: '/boops' | |
}, { | |
byUserId: function(user_id) { | |
var Collection = this, | |
collection = new Collection; | |
collection.fetch = function(options) { | |
options = options || {}; | |
options.data = options.data || {}; | |
options.data.user_id = user_id; | |
Collection.prototype.fetch.apply(collection, [options]); | |
}; | |
return collection; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment