rails/rails — pull request #18155 by bogdan (2014-12-23 00:58:06+00:00)
Title: Bugfix collection association #create method

When same association is loaded in the model creation callback
The new object is inserted into association twice.

``` ruby
Car.has_many :bulbs
Bulb.belongs_to :car
Bulb.after_create do |record|
record.car.bulbs.to_a # force loading
end

car = Car.create!
car.bulbs << Bulb.new
assert_equal 1, car.bulbs.size # returns 2 right now
```