rails/rails — pull request #9426 by exviva (2013-02-26 02:13:44+00:00)
Title: Do not overwrite manually built records during one-to-one nested attribute assignment

For one-to-one nested associations, if you build the new (in-memory)
child object yourself before assignment, then the NestedAttributes
module will not overwrite it, e.g.:

```ruby
class Member < ActiveRecord::Base
has_one :avatar
accepts_nested_attributes_for :avatar

def avatar
super || build_avatar(width: 200)
end
end

member = Member.new
member.avatar_attributes = {icon: 'sad'}
member.avatar.width # => 200
```