Module: Sequel::Plugins::AssociationDependencies::InstanceMethods

Defined in:
lib/sequel/lib/sequel/plugins/association_dependencies.rb

Instance Method Summary collapse

Instance Method Details

#after_destroyObject

Run the delete and destroy association dependency actions for many_to_one associations.


79
80
81
82
83
# File 'lib/sequel/lib/sequel/plugins/association_dependencies.rb', line 79

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

#before_destroyObject

Run the delete, destroy, and nullify association dependency actions for *_to_many associations.


87
88
89
90
91
92
# File 'lib/sequel/lib/sequel/plugins/association_dependencies.rb', line 87

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{|m| send(m)}
  super
end