I want to know how to integrate document versioning in a ruby on rails web app?
Let’s say, I create a post and save it in my database. Now there is another user and changes this post. And now I will provide the user the differences between those posts. Like in Github when a new commit was pushed to the repository.
Maybe it is possible to use git for this purpose? Or what is a good approach to save different versions of one post without saving the entire post x times.
Thanks.
Sounds like you’re looking for an “auditing library” which has the feature:
Only save the change and info about the changesuch a gem is paper_trail.
You can take a look at this rails cast for setup:
http://railscasts.com/episodes/255-undo-with-paper-trail
You can try the code:
And then use:
to access the change list.