documentcloud/backbone — Issue #793: Supporting polymorphic collections
Author: denniscollective
Created: 2011-12-16 19:09:28+00:00
State: open

Howdy!

Right now backbone seems to only support collections of one type, we're working on a stream with many polymorphic types that all quack the same.

It'd be nice to implement this via inheritance(extend), rather than our current technique of creating proxies/mixins in the base class.

backbone collection seems to have a hardcoded new this.model in it,

I was thinking about doing something like:

modelClass : function(){
return this[postType]
}

this.model = this.model || this.modelClass()

new this.model

is this a change you would like to have implemented, or are you opposed to it for an ideological reason?

If you want it, I'll implemented, as it will help me on a couple projects I'm working on.