I have the following association:
class Parent < ActiveRecord::Base
has_many :children, :dependent => :destroy
before_destroy :do_some_stuff
end
class Child < ActiveRecord::Base
belongs_to :parent
before_destroy :do_other_stuff
end
I would like to know in do_other_stuff if the destruction was fired by the dependent => destroy or not, because part of it will / will be done in do_some_stuff
I tried parent.destroyed?, parent.marked_for_destruction?, parent.frozen?but nothing seems to work: /
any ideas?
source
share