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
jonleighton (author)
Wed Sep 03 04:47:25 -0700 2008
commit  8f3c26fb8610184827b1f1f39d134bb681a82a9b
tree    cc45b8acf32f0c94e9ce3ef46f51b0440f5bb446
parent  18c9ffe6b1248a25044172471dda3af237f2cd46
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
  1. => {"employees"=>[#, #]}