-
Notifications
You must be signed in to change notification settings - Fork 528
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
really_destroy! on deleted record with a has_one association #414
Comments
We just ran into this same issue today. What I'm currently checking is to see if all our models that are on the other end of those has_ones can be switched to use |
I ended up submitting a PR to fix this. |
Until your PR is merged I stick to this workaround: Instead of
Use
|
An other option would be adding a has_one :foo, dependent: :destroy
has_one :foo_only_deleted, -> { only_deleted }, dependent: :destroy, class_name: "Foo" |
anybody here think PR #428 still worth it? or I should close ? the workaround by @joergschiller and @LeipeLeon looks sufficiant |
I'm trying to call really_destroy! on a record that has already been destroyed. The trouble is that it has a 'has_one' association and when that has_one is not deleted the parent record can't either due to a foreign key constraint.
I can see recursive restore handles 'has_one' association but really_destroy doesn't appear to. There is a comment about has_one returning nil and at this point
What's the best way to achieve this?
The text was updated successfully, but these errors were encountered: