Wrap discard methods in a transaction#124
Merged
Merged
Conversation
This seeks to solve issue: jhawthorn#77 Given the situation where a `before/after` callback fails, particularly with related records, we shouldn't still discard records. Note: This is leveraging a private API that exists in ActiveRecord::Transactions: https://github.com/rails/rails/blob/cd2949d2d936daa89b7e23f816f1c004aee85461/activerecord/lib/active_record/transactions.rb#L345 Co-authored-by: Will Cosgrove <will@cosgrove.email>
This was referenced May 27, 2026
|
No worries, glad to see it going in! (p.s. Hello 👋 things are good! Hope you're also doing well 😄) |
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We didn't have enough PRs with the same name, so this is my cherry pick of #84. (@grncdr I actually did this mostly last night before you'd pushed up yours, but thank you for doing that! My bad for not saying I would do it.)
This varies from the original mainly in that it removes the error handling which should be unnecessary in modern versions of ActiveRecord.