Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy Behavior #364

Closed
tpendragon opened this issue Apr 29, 2014 · 3 comments
Closed

Destroy Behavior #364

tpendragon opened this issue Apr 29, 2014 · 3 comments
Milestone

Comments

@tpendragon
Copy link

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?

@batter
Copy link
Collaborator

batter commented Apr 30, 2014

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.

@batter batter added this to the 3.1.0 milestone Sep 24, 2014
@batter
Copy link
Collaborator

batter commented Sep 24, 2014

This is fixed in 3.1.0 by 6de04f1. See #374 for more details about workflow on this issue.

@batter batter closed this as completed Sep 24, 2014
@webhat
Copy link

webhat commented Apr 20, 2015

In case somebody stumbles on this, there is no version 3.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants