module Sequel::Plugins::AssociationDependencies::InstanceMethods

def after_destroy

many_to_one associations.
Run the delete and destroy association dependency actions for
def after_destroy
  super
  model.association_dependencies[:after_delete].each{|m| send(m).delete}
  model.association_dependencies[:after_destroy].each{|m| send(m).destroy}
end

def before_destroy

*_to_many associations.
Run the delete, destroy, and nullify association dependency actions for
def before_destroy
  model.association_dependencies[:before_delete].each{|m| send(m).delete}
  model.association_dependencies[:before_destroy].each{|m| send(m).destroy}
  model.association_dependencies[:before_nullify].each{|p| instance_eval(&p)}
  super
end