I am searching for ideas about saving an overview of some (different) records during the time of a celebration, for instance user obtaining a document from the application, to ensure that this document could be regenerated later. What methods would you reccomend? Must I make use of the same table because the table with current values or make use of a historic table? Are you aware associated with a plug ins that may assist me to using the task? Please share your ideas and solutions.
You will find several plug ins with this.
functions as audited produces just one table its the auditable objects as well as no changes for your existing tables. You receive on entry per change using the changes saved like a hash inside a memo area, the kind of change (CRUD). It's very simple to setup with only just one statement within the application controller indicating which models you would like audited. Moving back can be you but the details are there. Since the information saved is only the changes building the entire object might be difficult because of subsequent changes.
A little more difficult to create- you'll need a separate table for every object you need to version and you've got to include a version id for your existing table. Rollback is an extremely easy. You will find forks on github that offer a hash of changes since last version so that you can easily highlight the variations (it's things i use). My prediction is this fact is easily the most popular solution.
Ones I've no training with: functions_as_revisable. I'll most likely give that one a try the next time I want versioning because it looks a lot more sophisticated.
Used to do this once some time back. We produced a brand new table which had a really similar structure towards the table we desired to log and once we required to log something, we did something such as this:
attr = object_to_log.attributes # Remove things like created_at, updated_at, other unneeded columns log = MyLogger.new(attrs) log.save
There's an excellent chance you will find plug ins/gems to complete that, though.
I have tried personally [cde] for that.
The OP is really a years old but thought I'd add vestal_versions towards the mix. It utilizes a single table to trace serialized hashes of every version. By crossing the record of changes, the models could be reverted to the time.
Appears to become the city favorite by this publish...