You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I may be doing something wrong, but in combining @radar 's paranoia and this I came to discover that, contrary to spec, it looks like the destroy hook actually saves the state the object was in AFTER the destroy runs. This results in strange timestamps in the version history as well as a deleted_at for Paranoia.
This seems to be a result of https://github.com/airblade/paper_trail/blob/master/lib/paper_trail/has_paper_trail.rb#L80 (record_destroy being called as an after_destroy hook - probably to avoid creating a version record if it fails to be created.) I've patched this locally by setting an instance variable to the result of #item_before_change and utilizing that in record_destroy - thoughts?
The text was updated successfully, but these errors were encountered:
You really shouldn't need paranoia AND PaperTrail attached to a model right? If you want to restore a destroyed model you could reify the last version and then re-save it.
But yes, I realize the timestamps are a bit behind on the version objects compared to when the events are actually happening, it's something that definitely needs fixing. It's due to the fact that we're using callbacks to build the objects but then not manually overriding those timestamps to match the ones on the model... See #354.
I may be doing something wrong, but in combining @radar 's paranoia and this I came to discover that, contrary to spec, it looks like the destroy hook actually saves the state the object was in AFTER the destroy runs. This results in strange timestamps in the version history as well as a deleted_at for Paranoia.
This seems to be a result of https://github.com/airblade/paper_trail/blob/master/lib/paper_trail/has_paper_trail.rb#L80 (record_destroy being called as an after_destroy hook - probably to avoid creating a version record if it fails to be created.) I've patched this locally by setting an instance variable to the result of #item_before_change and utilizing that in record_destroy - thoughts?
The text was updated successfully, but these errors were encountered: