With a regular has_many, there’s the option of :dependent => :destroy to delete the associations when the parent record is deleted. With has_many :through, there might be other parents associated to the child records, so :dependent => :destroy doesn’t have any effect.
How do you ensure child records are deleted after they are orphaned from the last HMT association?
The solution I have found seems to be an
after_destroycallback, such as this: