Fixes problem with replacing has_one association record with itself

    ActiveRecord::Schema.define do
      create_table :users do |t|
      end
     
      create_table :addresses do |t|
        t.integer :user_id
        t.string :street
      end
    end
     
    class User < ActiveRecord::Base
      has_one :address, :dependent => :destroy
    end
     
    class Address < ActiveRecord::Base
      belongs_to :user
    end

     user = User.create!
     address = user.create_address
     address.street = '1 Some St.'
     user.address = address

Fails with "can't modify frozen Hash" when attempting to save update has_one association.

full test gist: https://gist.github.com/scambra/7320315

discussion here: https://github.com/rails/rails/issues/12775