Seeking for model with `attributes` key in collection #4103

Closed
ksladkov opened this Issue Nov 24, 2016 · 1 comment

Projects

None yet

3 participants

@ksladkov
Contributor

When I tried to add objects like {id: 'some_id', attributes{}} to a collection multiple times, I got many such objects in this collection. All created models were with similar id.
I discovered it happens because a bit inaccurate in Backbone.Collection.get method - it seeks for id in obj.attributes without checking obj is a Model instance.
I think, such check should be added there.

@ksladkov ksladkov added a commit to ksladkov/backbone that referenced this issue Nov 24, 2016
@ksladkov ksladkov #4103 check if obj is Model in Collection.get 144627e
@kilbot
kilbot commented Nov 30, 2016

I just noticed this same problem.

@akre54 akre54 closed this Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment