jashkenas / backbone

Give your JS App some Backbone with Models, Views, Collections, and Events
http://backbonejs.org
MIT License
28.09k stars 5.39k forks source link

Add check for `this.model.prototype` #4234

Closed ogonkov closed 2 years ago

ogonkov commented 4 years ago

Simple check that this.model is constructor. We could have more complicated check, but looks like it doesn't required.

Fixes #4233

ogonkov commented 4 years ago

@jashkenas can you look at this PR? Seems minor change

jaapz commented 3 years ago

Would be nice to have this merged, because the documentation on backbonejs.org currently is inaccurate (https://backbonejs.org/#Collection-model), and it's impossible to implement polymorphic models based on attrs as of now

Edit: I got it working now by using the method described here: https://github.com/jashkenas/backbone/issues/4203#issuecomment-594086825

It's pretty ugly though.

jgonggrijp commented 2 years ago

~Already fixed, see #3966 and https://github.com/jashkenas/backbone/issues/4203#issuecomment-1003768061.~

jgonggrijp commented 2 years ago

Thanks @ogonkov!