title: Rails update_attributes RecordNotUnique
body: <p>I am trying to overwrite a record in rails 4.0.</p>
  
  <pre><code>old_p.update_attributes(new_p.attributes)
  </code></pre>
  
  <p><code>old_p</code> is the record pulled from the database, <code>new_p</code> is the record the user has created that will replace the record from the database. <code>new_p</code> actually has its own record in the database, but is only stored there temporarily.</p>
  
  <p>This seems to work some of the times, but most of the time it comes back with </p>
  
  <pre><code>ActiveRecord::RecordNotUnique in Controller#overwrite
  PG::UniqueViolation: ERROR: duplicate key value violates unique constraint
  </code></pre>
  
  <p>This is an upgrade from rails 2, and seemed to have been working as expected when it was a rails 2 app. There seems to be little documentation on update_attributes, but it seems as if it is copying the id of the object as well.</p>
  
  <p>I have also tried assign_attributes with .save later, but to the same effect. </p>
  
  <p>If it is copying the id of the object as well, is there a way to easily leave out the id? As the record has some 20+ attributes I would have to manually enter and they could change often. Or is there something else that I am missing?</p>