-
Notifications
You must be signed in to change notification settings - Fork 64
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
Force-destroying nested, permanent records not possible with foreign keys? #66
Comments
I just tested by swapping out this gem by acts_as_paranoid, it works with acts_as_paranoid, but I'd love to stick with this gem, because of the explicit scopes and the small codebase. :) Edit: Also works with the paranoia gem. |
If I understand this code correctly, they delete the associated records first, then the record itself within a transaction. |
Today I'm launched all specs with postgresql as DB and no specs failed. Seems that the issue requiring additional specs. |
@airpoli I have since switched to paranoia 2.2.0.pre. |
It's a bit, but not quite related to #65.
I'm trying to delete a permanent record, which
has_many
permanent records usingrecord.destroy(:force)
, but I get stuck because referential integrity is violated by doing this.I took a look at the specs, which try to verify that this works, but (I think) SQLite does not enforce referential integrity the way PostgreSQL does.
In the code I found this segment which seems to be the code at fault (should I be correct about my assumption).
The records in the
has_many
association are properly being saved independent_records
, however, the block, in this casesuper()
gets called before, meaning that before permanent_records has a chance to indeed delete the records that are permanent, my code crashes becausesuper
throws an exception before this can happen.The text was updated successfully, but these errors were encountered: