title: Rails transaction doesn't rollback on validation error
body: <p>I have two models: user and company.  They both get created from one form and I'm using a transaction like this:</p>
  
  <pre><code> User.transaction do
  
    @user.save!
  
    @company.user = @user
    @company.save!
  
    @user.reload
    @user.company = @company
    @user.save!
  
   flash[:notice] = "Thank you for your registration."
    redirect_to_index
  end
  </code></pre>
  
  <p>The user gets saved to the database even when one of the company's validations fails.  I've tried adding explicit error handling of ActiveRecord::RecordInvalid but it didn't help.  I thought the validation would raise the error to rollback the transaction anyway.  Any help is greatly appreciated.</p>
  
  <p>Thanks</p>