This Rails plugin reflects on a model’s associations, and returns a hash
of those which:
- Are not join associations
- Have the option
:dependent => :destroy
- Are not empty
- Are one-to-many or many-to-many
I use it to show the user what the consequences of deleting a particular
record will be.
Company.has_many :employees, :dependent => :destroy
@company.dependent_records
# => {"employees"=>[#(Employee id: 1), #(Employee id: 2)]}