Ok! will do and let you know.  Thanks!


2014-03-13 8:50 GMT-03:00 José Luis Di Biase <notifications@github.com>:

> In models/Sketch.js:
>
> > +    model: Sketch.ScheduleModel,
> > +    url: "sketchschedule",
> > +    comparator: "date",
> > +    backend: "sketchschedulebackend",
> > +    initialize: function () {
> > +        if (!server) {
> > +            this.bindBackend();
> > +            this.bind('backend', function(method, model) {
> > +                console.log ('got from backend:', method, model);
> > +            });
> > +        }
> > +        console.log ('creating new SketchScheduleCollection');
> > +        return Backbone.Collection.prototype.initialize.call (this);
> > +    },
> > +});
> > +
>
> You must think, like in relational database but within models. So you can
> set relation like one to one, one to many..
> Take a look at Media.Occurrence that it is similar:
>
>   319 Media.Occurrence = Backbone.RelationalModel.extend({
>   320     urlRoot: 'occur',
>   321     idAttribute: '_id',
>   322     relations: [{
>   323         includeInJSON: '_id',
>   324         type: Backbone.HasOne,
>   325         key: 'playlist',
>   326         relatedModel: 'Media.Playlist',
>   327         reverseRelation: {
>   328             key: 'occurrences',
>   329             collectionType: 'Media.Schedule',
>   330             includeInJSON: '_id',
>   331             type: Backbone.HasMany
>   332         }
>   333     }],...
>   376 });
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/inaes-tic/mbc-common/pull/66/files#r10561040>
> .
>