Backbone-relational icon indicating copy to clipboard operation
Backbone-relational copied to clipboard

Use 'subModelTypes' in a Relational Model

Open jbsouvestre opened this issue 10 years ago • 0 comments

Hi,

I would like to know if the use case presented in this jsfiddle is possible with Backbone Relational

http://jsfiddle.net/fe0wkws8/2/

In this example, I would like Zoo to have a collection of Primate, Primate being an abstract model of Chimp and Gorilla. I would like those models to be constructed only when calling fetchRelated on Zoo.

It appears that the models are being initialised when instantiating the Zoo abjet, and therefore only creating Primate objects (because it doesn't have a type field at the moment). Is there a way to instantiate the models only after the fetchRelated is called ? Is this a use case for createModels ?

Thanks a lot

jbsouvestre avatar Oct 01 '14 19:10 jbsouvestre