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

Fixed has_one bug with really_destroy! after destroy #428

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

Conversation

harryhlai
Copy link

When an object and its associated objects have been soft deleted, the associations return empty collections and nil because of the default scoping. The logic for restore correctly handles this, but the logic for really_destroy (for an object that has already been soft deleted) fails for has_one associations. To see an example of this failing, look at the test case added in this PR; that test case fails with the current core branch.

This PR fixes that by refactoring the logic used in restore, and re-using it for really_destroy.

@harryhlai harryhlai changed the title Fixed bug with really_destroy! after destroy and has_ones. Fixed has_one bug with really_destroy! after destroy Nov 3, 2017
… logic in #restore_associated_records and leverage it for really_destroy.
@mathieujobin
Copy link
Collaborator

I am only seeing this now... I resolved the conflict simply by keeping both sides.
@harryhlai do you think it still makes sense to merge this?
can you update and see why the tests are failing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants