Skip to content

Force-destroying nested, permanent records not possible with foreign keys? #66

@aried3r

Description

@aried3r

It's a bit, but not quite related to #65.

I'm trying to delete a permanent record, which has_many permanent records using record.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 in dependent_records, however, the block, in this case super() gets called before, meaning that before permanent_records has a chance to indeed delete the records that are permanent, my code crashes because super throws an exception before this can happen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions