What is the best/cleanest/easiest way to maintain the edit history of records in Rails?
I'm looking for logging – who made the edits and when and the ability to rollback to earlier versions of records.
My guess is that you would use ActiveRecord callbacks on updates or deletes and instead of updating/deleting records you would create a new one and have some sort of identifier to keep the same "record" associated, maybe a field to distinguish which record is current, and a version field.
I vaguely recall seeing some plugins but I can't seem to find them at the moment.r
(Is there a term for this that I don't know?)
Best Answer
acts_as_audited wins hands down. You can even use acts_as_versioned with it. The plugin-page explains everything. Go through the discussion comments below the post on the page. Developers have posted issues and have obtained positive responses from the author and others.
I have used this plugin in many apps and I find it very very useful. Highly recommended.
Here is a preview from the plug-in page: