Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idAttribute causing bug in Supermodel #3

Closed
wookiehangover opened this issue Nov 6, 2014 · 2 comments
Closed

idAttribute causing bug in Supermodel #3

wookiehangover opened this issue Nov 6, 2014 · 2 comments
Labels

Comments

@wookiehangover
Copy link

We've recently uncovered a bug in Supermodel pathable/supermodel#57 that prevents Items from being stored in their singleton backing collection.

This happened in 6b1e9e when we added the idAttribute property to the item model. There appears to be a work-around that I'm looking into presently, but I wanted to give folks a heads up before I opened a PR.

cc/ @justinabrahms @joestump

@wookiehangover
Copy link
Author

finally figured it out – full solution here: http://jsbin.com/golucuduwa/2/edit?js,console

tl;dr – you've gotta make sure to call super if you override initialize in a supermodel

@nonsensery
Copy link

FWIW, there's a typo in that JSBin... it says:

var Collection2 = Backbone.Collection.extend({
  model: function(attrs, options) {
    return Model.create(attrs, options);
  }
});

But it should be calling create() on Model2, like: http://jsbin.com/sotilibeja/1/edit?js,console

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants