emberjs/data — pull request #2578 by fivetanley (2014-12-12 00:35:44+00:00)
Title: fix incorrect iteration issues in Relationship#clear

currently, Relationship.prototype.clear uses the `forEach` from Ember.Set/OrderedSet. The implementation of forEach looks like:

```javascript
forEach = function(callback) {
for(var i =0; i < this.members.length; i++){
callback(this.members[i];
}
}
```

If you are *mutating* the set (adding or removing) in the callback passed to forEach, you will run into subtle bugs. For instance, the forEach callback may not be called with records in the set, which is what happened to trigger the bug demonstrated by the failing test case commit.