Open aried3r opened 8 years ago
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.
@aried3r @drakmail did you find a solution for this?
@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.