Problem
In app/models/user.rb:21:
```ruby
has_many :case_assignments, foreign_key: "volunteer_id", dependent: :destroy # TODO destroy is wrong
```
The `# TODO destroy is wrong` comment has been there for a while, flagging a known but unaddressed issue. Worth investigating and resolving:
- Cascade may discard history. When a volunteer user is destroyed (or soft-deleted via paranoia), all their `case_assignments` rows are destroyed. `case_assignments` is the join record between volunteers and `casa_cases` and likely carries history (active flag, dates) that should survive the volunteer being deactivated.
- Interaction with paranoia. The `User` model uses soft-delete in places — `dependent: :destroy` runs `destroy` callbacks on the dependents, which may or may not honor soft-delete depending on each model's setup.
- Same FK pattern on `case_contacts`, `followups`, `other_duties` at lines 24, 26, 31 deserves the same audit — those have `dependent: :destroy` too and may have the same problem.
What to investigate
Acceptance criteria
Problem
In
app/models/user.rb:21:```ruby
has_many :case_assignments, foreign_key: "volunteer_id", dependent: :destroy # TODO destroy is wrong
```
The `# TODO destroy is wrong` comment has been there for a while, flagging a known but unaddressed issue. Worth investigating and resolving:
What to investigate
Acceptance criteria