rails icon indicating copy to clipboard operation
rails copied to clipboard

Fix issue with destroy after RestartParentTransaction and SavepointTransaction rollback

Open mguan2020 opened this issue 5 months ago • 13 comments

Motivation / Background

This Pull Request has been created in order to fix issue #50338.

Detail

This Pull Request provides a working solution for the destroy function for the cases of RestartParentTransaction and SavepointTransaction.

Previously, the destroy function was not properly removing entries from the database for the RestartParentTransaction and SavepointTransaction. If @_trigger_destroy_callback is true at the beginning of the destroy function, destroy_row would never be invoked.

This Pull Request will ensure destroy_row is invoked when @_trigger_destroy_callback is true at the beginning of the destroy function. This will remove the corresponding row from the database. Otherwise, if @_trigger_destroy_callback is false, destroy_row is only invoked if persisted? is true.

Additional information

Checklist

Before submitting the PR make sure the following are checked:

  • [x] This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • [x] Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • [x] Tests are added or updated if you fix a bug or add a feature.
  • [x] CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

mguan2020 avatar Dec 18 '23 00:12 mguan2020