Skip to content

Instantly share code, notes, and snippets.

@mattd
Created May 24, 2012 13:50
Show Gist options
  • Save mattd/2781648 to your computer and use it in GitHub Desktop.
Save mattd/2781648 to your computer and use it in GitHub Desktop.
define([
"namespace",
// Libs
"use!backbone",
// Modules
"modules/asset",
// Plugins
],
function (namespace, Backbone, Asset) {
var Section = namespace.module();
Section.Model = Backbone.Model.extend();
Section.Collection = Backbone.Collection.extend({
url: '/api/users/newsfeed/',
fetch: function (options) {
options = options || {};
options.success = function (collection, response) {
_(collection.models).each(function (section) {
section.set(
'assets',
new Asset.Collection(section.get('assets'))
);
});
};
return Backbone.Collection.prototype.fetch.call(this, options);
}
});
return Section;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment