Models in Hubbub

We've already created our issue model and parts of our repo model. Let's finish off the repo model and add the main "board" model also.

Here's the full repo model:

 // models/repo.jsRepo.Model = Backbone.Model.extend({    initialize: function () {      this.issues = new app.Issue.Collection();      this.issues.repo = this;      // When this repo is destroyed, destroy its issues too.      this.on('destroy', function () {        _.invoke(this.issues.models.slice(), 'destroy');      });    },     url: function () {      return app.apiRoot + '/repos/' + this.get('full_name');    },    urlRoot: function () {      return app.apiRoot + '/users/' + this.get('owner').login + '/repos';    },    toBoard: function () {      var attrs = _.pick(this.attributes, 'id', 'name'); attrs.owner = {login: this.get('owner').login}; ...

Get Developing a Backbone.js Edge now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.