Why use this instead of something like Papertrail?

mrbrdo edited this page Jun 9, 2012 · 1 revision

Papertrail and vestal_versions for example, are designed not for moderation, but for tracking changes on models. If you use Papertrail for moderating, you will always have the “newest” version in the database, while previous changes will be recorded in a special table. The problem with this for moderation is that when you are showing records, you have to read from both the model table and the “changes” table in the database, and do additional processing to combine them. This will impact performance quite a bit.

In contrast, with this gem the database will always represent the last accepted/confirmed version of the model, and not necessarily the newest as with Papertrail. A “changes” table like in Papertrail is used here too, but it is used to store “suggested” (to-be-accepted) changes. Therefore you have no performance hit when querying for the last accepted version of the model, like you would have with Papertrail. You only have a performance hit when accepting a moderation, but this is irrelevant. Also this way all changes submitted are relative to the currently last accepted version and not to the newest version like in Papertrail.

So Papertrail and vestal_versions are designed for model versioning and changes tracking, while this gem is designed for moderation. The database will not be changed until a moderation is actually accepted.

Note that because of this, handling associations is quite a bit harder, so this gem is a little bit more complex. Therefore is recommended you test moderated associations before deploying to production, to avoid any possible bugs.