Skip to content

Fix after_commit on: :destroy not being triggered#404

Closed
npezza93 wants to merge 1 commit into
rubysherpas:corefrom
npezza93:fix-after-commit
Closed

Fix after_commit on: :destroy not being triggered#404
npezza93 wants to merge 1 commit into
rubysherpas:corefrom
npezza93:fix-after-commit

Conversation

@npezza93

@npezza93 npezza93 commented May 3, 2017

Copy link
Copy Markdown

Shoutout to @skorfmann on #228 for for most of this! Fixes #217

Let me know if there are any issues with this approach.

Comment thread lib/paranoia.rb Outdated
when :destroy
transaction_include_destroy?
when :update
!(transaction_record_state(:new_record) || transaction_include_destroy?)

@BenMorganIO BenMorganIO May 5, 2017

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use a x && y instead of a !(x || y)? nvm, I had some of the boolean logic mixed up in my head...

@npezza93 npezza93 force-pushed the fix-after-commit branch from fa715e3 to 05ed75f Compare May 5, 2017 12:44
@npezza93

npezza93 commented May 5, 2017

Copy link
Copy Markdown
Author

Remade this to accommodate rails 5.1 @_trigger_{action}_callback instance methods from this commit: rails/rails@371c083

@npezza93 npezza93 force-pushed the fix-after-commit branch from 05ed75f to 682ca2a Compare May 5, 2017 12:51
@rmachielse

Copy link
Copy Markdown

@npezza93 @BenMorganIO any idea on when this will be merged? We could use the change quite well.

@npezza93

npezza93 commented May 25, 2017

Copy link
Copy Markdown
Author

@rmachielse ¯\_(ツ)_/¯, I haven't heard anything so I think it's up to @BenMorganIO.

@rmachielse

Copy link
Copy Markdown

@BenMorganIO what are your thoughts about this?

@rmachielse

Copy link
Copy Markdown

@BenMorganIO is there any chance this gets merged soon?

@rmachielse

Copy link
Copy Markdown

@BenMorganIO anything I can do to speed this up?

@rmachielse

Copy link
Copy Markdown

Is there anyone else who can pick this up? @jhawthorn maybe?

@fenak

fenak commented Aug 13, 2017

Copy link
Copy Markdown

That'd be very helpful for me as well, would like to see it on upstream. 👍

@koenpunt

koenpunt commented Jan 3, 2018

Copy link
Copy Markdown

While this probably is the best approach; it differs from how it behaves with Rails 4.2. There a "soft delete" would trigger the update callback, and the destroy callback is called only for really_destroy

@dholdren

dholdren commented May 4, 2018

Copy link
Copy Markdown

any update on this? I'm running into this now and surprised it hasn't been addressed yet

@JorgeGarciaxyz

Copy link
Copy Markdown

Any update ?

@ruubyy

ruubyy commented Oct 16, 2019

Copy link
Copy Markdown

+1

@razum2um

Copy link
Copy Markdown

@npezza93 thanks for initial PR ❤️

@BenMorganIO will you merge & release it if we'll rebase && fix travis? /cc @jhawthorn

@npezza93

npezza93 commented Jan 8, 2021

Copy link
Copy Markdown
Author

I believe this is has been fixed with a combo of the latest release and rails >= 5.2

@npezza93 npezza93 closed this Jan 8, 2021
@npezza93 npezza93 deleted the fix-after-commit branch January 8, 2021 14:16
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

Successfully merging this pull request may close these issues.

after_commit on: :destroy hooks are broken in 2.1.0

9 participants