zendesk/ember-resource — pull request #43 by jamesarosen (2013-08-28 00:37:52+00:00)
Title: Correct scope in ResourceCollection#parse (for real)

@jish @shajith This is a follow-on to d4480bc31af32fea2f21aa689c208eac57e444c4

Originally, `ResourceCollection#parse` iterated over each item in the JSON array and called `this.type.parse` on it. Unfortunately, `this.type.parse` was the result of an `Ember.wrap` call, which sets `this._super` for inheritance support. Because we weren't passing a `this` pointer to `map`, it was being called on `window`, which caused the wrapped `_super` call to leak.

d4480bc31af32fea2f21aa689c208eac57e444c4 changed the `map` call to set the context of `this.type.parse` to `this`, but the `this` there is the `ResourceCollection` instance. Instead, it should be the model class. This commit changes the `this` pointer to `this.type`, which is the collection object's reference to its model type.

See also #41