rails/rails — pull request #13166 by bogdan (2013-12-04 14:26:06+00:00)
Title: [Regression 3.2 -> 4.0] Fix bugs with changed attributes tracking when transaction gets rollback

The most common scenario to demonstrate the bug:

``` ruby
assert !model.approved?
Topic.transaction do
model.approved = true
model.save!
raise ActiveRecord::Rollback
end
model.save!
assert @first.reload.approved
```

In the last `#save!` call will not save model in DB because `#changes` from AR::Dirty is not properly rollback to the beginning of transaction state.

I've made a 4 different scenarios in test cases to be sure my patch covers everything. If you would consider some of them an overkill please just let me know.