Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Lists the associated records which will be destroyed by destroying a particular record
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
tasks
MIT-LICENSE
README.textile
Rakefile
init.rb
install.rb
uninstall.rb

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)]}
Something went wrong with that request. Please try again.