title: Rails 5: update_attributes with unique constraints
body: <p>I'm trying to call a <code>find_or_initialize_by</code> in a controller like so:</p>
  
  <pre><code>@lead = Lead.find_or_initialize_by(external_id: lead['external_id'])
  @lead.update_attributes(lead)
  </code></pre>
  
  <p>That's all well and good, but my problem is that <code>lead</code> can and should have some information in it that has unique constraints on my model:</p>
  
  <pre><code>validates :address, uniqueness: { scope: [:address, :city, :state, :zip] }
  validates :voter_id, uniqueness: true
  validates :external_id, uniqueness: true
  validates :email, uniqueness: true, allow_blank: true, allow_nil: true
  validates_presence_of :first_name, :last_name, :address, :city, :state, :zip, :source, :status
  </code></pre>
  
  <p>So, when a lead already exists in the database, <code>update_attributes</code> fails because the hash contains the same information the record already did (coupled with a non-unique difference):</p>
  
  <pre><code>ActiveRecord::RecordInvalid (Validation failed: Address has already been taken, Voter has already been taken, External has already been taken):
  </code></pre>
  
  <p>How can I pass this hash and have Rails save it regardless of whether it's new (made by <code>initialize_by</code>) or existing (made by <code>find</code>) while maintaining all that validation?</p>