lib/mongoid/interceptable.rb
# Get the name of the callback that the child should fire. This changes
# depending on whether or not the child is new. A persisted parent with a
# new child would fire :update from the parent, but needs to fire :create
# on the child.
#
# @example Get the callback type.
#   document.child_callback_type(:update, doc)
#
# @param [ Symbol ] kind The type of callback.
# @param [ Document ] child The child document
#
# @return [ Symbol ] The name of the callback.
Get the name of the callback that the child should fire. This changes
depending on whether or not the child is new. A persisted parent with a
new child would fire :update from the parent, but needs to fire :create
on the child.
Get the name of the callback that the child should fire . This changes depending on whether or not the child is new . A persisted parent with a new child would fire : update from the parent but needs to fire : create on the child .
def child_callback_type(kind, child)
      if kind == :update
        return :create if child.new_record?
        return :destroy if child.flagged_for_destroy?
        kind
      else
        kind
      end
    end
def child_callback_type ( kind , child ) if kind == :update return :create if child . new_record? return :destroy if child . flagged_for_destroy? kind else kind end end
Get the name of the callback that the child should fire.
Get the name of the callback that the child should fire .
The name of the callback.
The name of the callback .
 Symbol 
kind
child
child The child document
child The child document
example
Get the callback type. document.child_callback_type(:update, doc)
Get the callback type . document . child_callback_type ( : update doc )