technoweenie/serialized_attributes — pull request #13 by dwbutler (2013-01-21 19:11:13+00:00)
Title: Paper Trail compatibility

Hi,

I've been trying to get serialized_attributes and [Paper Trail](https://github.com/airblade/paper_trail) to work happily together. It turns out that Paper Trail depends on quite a few ActiveRecord features that didn't happen to be implemented for serialized attributes.

Instead of creating a bunch of different pull requests, I decided to lump everything together and just summarize what got changed.

* Fixed a bug where a reference to the 'data' field was hardcoded as ```data``` instead of using ```send(data_field)```.
* Added support for dirty attributes by calling ```attribute_will_change!```.
* Overrode ```dup``` so it copies over a dup of the serialized data. Previously, the dup'ed object would keep a reference to the same serialized data as the original object. This fix is necessary because Paper Trail creates a version by duping the object, and then setting all attributes back to their previous values. So, modifying the dup was also modifying the serialized attributes on the original object.
* Added support for ```[]=``` AKA ```write_attribute``` to modify serialized data.