-
Notifications
You must be signed in to change notification settings - Fork 529
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
Fix create callback called on destroy #513
Fix create callback called on destroy #513
Conversation
can you please rebase your branch with |
Would really appreciate getting this fix into the wild :) |
@mathieujobin is the requirement just rebasing the branch to core and this will be GTG? thnx |
I will have another review after I see all tests passing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just would like to see the tests running on CI ...
I have rebased this branch into a new branch. all tests passed. including with the test in #522 I will release later https://github.com/rubysherpas/paranoia/actions/runs/2026193146 |
* update Rails * add specs for broken case * apply fix Co-authored-by: Djilani Kebaili <djilani.kebaili@epfl.ch>
We were running into a weird bug in one of our projects while migrating from Rails 5.2 to Rails 6.0. It seems to be due to Rails using
#with_transaction_returning_status
when persisting models which takes care of setting the recently-added ivar@_new_record_before_last_commit
. Paranoia overrides ActiveRecord's#destroy
with#paranoia_destroy
which unfortunately only uses#transaction
, so when checking for which callbacks should be run, it was seeing a stale value of@_new_record_before_last_commit
, therefore causingafter_create_commit
hooks to be called again.