soft-destroyable

Installation
SKILL.md

Soft Destroyable

app/models/concerns/soft_destroyable.rb marks records deleted by setting a deleted_at timestamp instead of removing rows. If the concern isn't there, run bin/rails g rolemodel:soft_destroyable.

Making a model soft-destroyable

  1. Add a nullable deleted_at datetime column (the generator doesn't add one).
  2. Include the concern, and cascade to any associations that should go and come back with the parent:
class Estimate < ApplicationRecord
  include SoftDestroyable

  has_many :line_items
  cascade_soft_destroy :line_items   # each associated model must also include SoftDestroyable
end

Rules

Installs
3
GitHub Stars
7
First Seen
Nov 4, 2026