This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Snapshot of model attributes in modifications (instead of hash) for initial versions
Currently, when initial_version is set to true, the initial version is created with an empty hash in modifications.
However, I propose storing a snapshot of the model attributes in modifications for easy review, as in cases where the versioned object is deleted, you will still have a history of how the object was like in its initial state.
Note that as the versioned object is deleted, revert_to method cannot be used to obtain the initial state of the versioned, so a better solution, IMO, is to store a snapshot.
Creates a version with user on destroying a versioned object, if updated_by was set
When the option :dependent => :tracking is used, and a versioned object is deleted, a version would be created to record the deletion of the object along with its last seen attributes (so that it can be reverted).
However, it does not capture information of who deleted that versioned object, even when :updated_by was set.
Commit d66a190 fixes this problem.