title: Update multiple records in one ActiveRecord transaction in Rails
body: <p>How can I update/save multiple instances of a model in one shot, using a transaction block in Rails?</p>
  
  <p>I would like to update values for hundreds of records; the values are different for each record. This is <em>not</em> a mass-update situation for one attribute. Model.update_all(attr: value) is not appropriate here. </p>
  
  <pre><code>MyModel.transaction do
      things_to_update.each do |thing|
          thing.score = rand(100) + rand(100)
          thing.save
      end
  end
  </code></pre>
  
  <p><code>save</code> seems to issue it's own transaction, rather than batching the updates into the surrounding transaction. I want all the updates to go in one big transaction. </p>
  
  <p>How can I accomplish this?</p>