emberjs/data — pull request #325 by rw (2012-07-10 22:13:06+00:00)
Title: Bug fix: adding records client-side to RecordArrays was not properly updating indexes

## TL;DR

Adding records client-side to RecordArrays does not properly update indexes.

## Problem

Given a model that has a relationship,

```javascript
var Comment = DS.Model.extend({
posts: DS.belongsTo("Post")
});

var Post = DS.Model.extend({
comments: DS.hasMany("Comment")
});
```
when creating a client-side associated object,

```javascript
var post = store.createRecord(Post);
var comment = store.createRecord(Comment);
post.comments.pushObject(comment);
```
and then deleting it,

```javascript
post.deleteRecord();
```
the RecordArray is not informed of its deletion:

```javascript
post.comments.contains(comment) === true;
```

When associations are created client-side, the appropriate indexes are not updated.

## Solution

Update the indexes of the collection on insertion (pushObject), so that the record is removed from the collection when it is deleted.