public
Description: Lists the associated records which will be destroyed by destroying a particular record
Homepage:
Clone URL: git://github.com/jonleighton/dependent_records.git
README.textile

Dependent Records

This Rails plugin reflects on a model’s associations, and returns a hash
of those which:

  1. Are not join associations
  2. Have the option :dependent => :destroy
  3. Are not empty
  4. 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.

Example

Company.has_many :employees, :dependent => :destroy
@company.dependent_records
# => {"employees"=>[#(Employee id: 1), #(Employee id: 2)]}