If I would like to create a model like Record which stores say a personal record (say record time for 100m dash). Now what if I wanted people to set new personal records (faster time for 100m), how would I store this in the database.
I was thinking about a versioning database like couchDB, but that sounds like overkill. I also could reference records with another id, like
Record
:id
:name
:record_id #=> this refers to the original Record
However this also seems like a dirty solution (refencing a model to itself). Now I’m sure this is a common problem (rewriting a model instance, but keeping a history) and I was wondering if there was a good solution to this?
You would want to look into a gem like papertrail Then you could set up versioning for the object.
Using the gem is also easy, after you set it up you can use it and it will return an array of the versions: