title: Rails 4 update_all and set value from another field
body: <p>I need to do some bulk updates in some models and set value of a field as value of another field.</p>
  
  <p>Right now I can do that with raw sql like this:</p>
  
  <pre><code>ActiveRecord::Base.connection.execute("UPDATE `deleted_contents` SET `deleted_contents`.`original_id` = `deleted_contents`.`id` WHERE `deleted_contents`.`original_id` is NULL")
  </code></pre>
  
  <p>This is working fine, however I need to do this using ActiveRecord query interface due to many reasons.
  I tried:</p>
  
  <pre><code>DeletedContent.where(original_id: nil).update_all(original_id: value_of_id_column)
  </code></pre>
  
  <p>For value_of_id_column I tried :id, self.id, <code>id</code>, etc, nothing works. What should I set for value_of_id_column to get the original query generated by rails? Is this possible, or using the raw sql is the only solution? </p>
  
  <p>Also I do not want to iterate over each record and update. This is not a valid solution for me:</p>
  
  <pre><code>DeletedContent.where(original_id: nil).each do |deleted_content|
      update_each_record
  end
  </code></pre>