Hi All,
I’m looking for the best way to add some lightweight versioning to my
ActiveRecord model.
Long story short, I work on an image hosting site, where each
ActiveRecord
of a resource contains some description fields and links to attachments.
Users submit resources, and they are reviewed by admin before made
available to the public. Once an image is made public, the original
author
can make changes to the resource, but that change needs to be reviewed
before it can be made public again.
The problem is, we don’t want to take down a resource once it goes live
just because the author decides to submit some edits. Instead, we want
the
ability to continue showing old version of the resource on the live
site,
during this edit/review stage. So, the edits need to be saved somewhere
else.
I looked into using versioning plugin like PaperTrail, but it seems too
heavy handed. An alternative approach is to duplicate all fields in the
resource, so the edits are stored in the duplicate fields; but this
doesn’t
seem like an elegant solution. A third possibility is to create a
temporary
resource (perhaps even of a different type) just to hold the values
being
edited, and copy those values back to the main resource once edits are
approved. This still has some complexity, but I’m leaning toward the
third
approach.
Any ideas for better way of handling this problem?
Thanks,
Yi