title: Saving record fails due to uniqueness conflict with itself?
body: <p>I have a procedure which receives two models, one which already exists, and another one which holds new attributes which I want to merge in the first one.</p>
  
  <p>Since other parts of the program are holding the same reference to the new model, I can't just operate on the existing one. Therefor I do the following:</p>
  
  <pre><code>def merge(new_model, existing_model)
      new_model.attributes = existing_model.attributes.merge(new_model.attributes)
      new_model.id = existing_model.id
  end
  </code></pre>
  
  <p>Now the new_model is being saved which gives me the uniqueness erorr (even though it's technically the same model). I also tried using the reload method, but that yields the same result.</p>
  
  <p><strong>Background:</strong></p>
  
  <p>The method above is run in a before_add callback on an association. I want to be able to call update on a model (with nested associations) without having to specify IDs of the nested models. This update is supposed to merge some associations, which is why I try to do the whole merge thing above.</p>