rails/rails — pull request #12135 by dylanahsmith (2013-09-04 22:50:00+00:00)
Title: Avoid empty transaction from setting has_one association on new record.

## Problem

When setting a has_one association on a new record as follows

```ruby
Firm.new.account = account
```

it would open a transaction even though it wasn't saving the record. So the the following database queries would get sent.

```
SAVEPOINT active_record_1
RELEASE SAVEPOINT active_record_1
```

## Solution

Update the `save` variable to reflect whether the record will be saved. This way the check to determine if the transaction should be opened and the check to see if the record should be saved will be consistent.