airblade/paper_trail — pull request #440 by moserrya (2014-11-06 18:06:04+00:00)
Title: clear rolled back versions from associated model

I propose this change to fix an issue where, under the right circumstances, version records are created for changes that never took place. Let's say I have two models, `Item` and `Location`, and attempt to save changes in a transaction:

```ruby
item.transaction do
item.update_attributes!(sku: 'AYH123HJLF')
Location.first.update_attributes!(code: '999-999')
end
```

The `Item` model here `has_paper_trail`. A version is created for the item's `update_attributes!` call is created and then rolled back, as expected. However, if we rescue from the error that happens when we run `Location.first.update_attributes!` and then call `item.save`, the rolled back version created when we tried to update the sku in a transaction is also saved - even though the sku on the item is not changed.