nearinfinity/auditor — pull request #5 by carlo (2012-02-18 23:25:24+00:00)
Title: FIX for issues with ActiveRecord 3.1+

When using AR 3.0, empty serialized fields (like `Audit#audited_changes`) were either not written to the DB or not serialized before writing. In effect, an empty serialized field was stored as `NULL`. `nil` in the model was `NULL` in the DB.

In AR 3.1, that changed; the field is apparently serialized no matter what, resulting in a YAML string representing a `nil`. Nonetheless, it's a string and not `NULL`. Thus, the explicit check in the `Audit.modifying` scope failed.

I've just fixed the scope definition (took me a while to find that bug…) and left the rest untouched, even though I've tested the changes with both AR 3.1.3 and AR 3.2.1. It'd be nice if you could take a look, merge if okay and adjust the gemspec to allow for `activerecord >3.0.0` soon. :)

Cheers,
Carlo.