Skip to content

Conversation

@alecdotninja
Copy link
Contributor

Without this patch, DestroyedAt#destroy does not roll back the transaction when the callback chain is halted. This deviates from the standard ActiveRecord behavior and breaks several features. It is particularly dangerous for associations using dependent: :restrict_with_error which are silently destroyed.

The same semantics have been extended to DestroyedAt#restore. I've also added a DestroyedAt#restore! and corresponding error class (DestroyedAt::RecordNotRestored) to mimic ActiveRecord::Base#destroy! and friends.

…hat is rolled back when the callback chain is halted
@alecdotninja
Copy link
Contributor Author

Coincidently, this also solves #56.

@michaeldupuisjr
Copy link
Contributor

Thank you for the PR @anarchocurious, and I apologize for the delay in getting merged in.

It looks like this branch needs to be rebased, as we have a conflict based off of the work in ae82efb. Please ping me when you have a chance to rebase and I will get this merged in.

Thanks!

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.

2 participants