rails/rails — pull request #3610 by mlangenberg (2011-11-11 12:34:14+00:00)
Title: Failing test for find_or_initialize_ updating has_many collection size.

When a record is initialized through a has_many association, the record is added to the target association.
On a record.save, this record is not updated or replaced in the in-memory association.

e.g.

```ruby
@tree.apples.size #=> 1
apple = @tree.apples.find_or_initialize_by_color('Red')
@tree.apples.size #=> 2, so it added a record in-memory.
apple.color = 'Green'
apple.save
@tree.apples.size #=> 3 !!! It did reload records from database. It did not clear in-memory records.
@tree.apples.last.color #=> 'Red'
@tree.apples.last.new_record? #=> true
@tree.apples.second.color #=> 'Green'
@tree.apples.second.new_record? #=> false
```