Skip to content
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

_denormalize_destroy_to_* callback fixed to trigger before the destroy op #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pranav-g10
Copy link

This commit fixes issue #42

@joshed-io
Copy link
Owner

THanks @pranav-g10, this looks great. Is it possible to add a test case for when the restrict option is used?

The to_alize destroy callbacks used to be a after_destroy
callback which failed when relations specified a :nullify
dependency - since mongoid would nullify all relations before
the destroy and the after_destroy callback would find no children
after the destroy op to sync.

Changed the callback to be triggered before the destroy op, except
in the case of a :restrict dependency where a before_destroy callback
would pre-maturely sync the child objects even though the destroy op
may never happen
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