ActiveRecord change log behavior

This extension/behavior is based on the following Cookbook article: How to log changes of ActiveRecords?.

SystemLog is a behavior that will record every create/update/delete action performed within an ActiveRecord-based model, including whom made the change, and (if the Timestamp behavior is enabled) when the change occurred. (Just a note, while it currently relies on the Timestamp behavior, that is subject to change, as I’ll likely just move timestamp handling directly into SystemLog)

Disclaimer: The paragraph below talks about what SystemLog could be used for, but there is no interface built yet for viewing/reverting record changes

What’s great about this, is that it should be rather simple to create an interface to display modified records, and the change history of each individual record (with the ability to revert changes). So if an admin becomes overzealous with updating or deleting records, those changes could be reverted easily.

Check out the behavior here:

SystemLog Behavior - http://code.google.com/p/cranium-crm/source/browse/trunk/private/components/behaviors/

I still have some changes to make (noted in the @todo), comments to add.

Once it’s ready, I’ll of course provide the SQL and models that are associated with the behavior.

Any initial thoughts?

Link is not working… I get "google error - not found"

Thx mdomba, turns out the forum is lowercasing the "b" in SystemLogBehavior.php, thus breaking the URL.

URL updated to point to the directory where the file resides, testing fine right now.

google code work link: http: // code[dot]google[dot]com/p/cranium-crm/source/browse/private/components/behaviors/SystemLogBehavior.php