How to find what all associations have dependent: destroy associated with them from a concern

I am building a soft delete solution a la

. Right now I am manually finding which all associated models need to be
deleted when a model is deleted and doing it manually in each model
of course is a not a good practice. How do I do it? I don’t want to use
gem, I want to write logic in my own hands.