I’m looking to save states in my web application, so that users may go “back in time”. To simplify, let’s say that the user can create a collection of notes, and at any point in time, they can save the current state of their collection, and then go back and view it as it was when it was saved.
Is there a best practice for this? I was imagining storing a JSON hash of the collection of notes at at the time it is requested, in a column in some table with SQL, then simply parsing the data and displaying it to the user when it’s requested. Would a document store like mongoDB work in my favor here? Is there a better method using relational databases? My app is currently running on Rails and MySQL.
Any suggestions are appreciated!
Sounds like you’re looking for papertrail! It allows versioning of models using a pretty simple syntax; you can go back in time to see the model as it was at any time, or the previous version, or even undelete models after they’ve been destroyed.
Check it out, it sounds like it’d solve your problem.