lib/mongoid/interceptable.rb
# Get all the child embedded documents that are flagged as cascadable.
#
# @example Get all the cascading children.
#   document.cascadable_children(:update)
#
# @param [ Symbol ] kind The type of callback.
#
# @return [ Array<Document> ] The children.
Get all the child embedded documents that are flagged as cascadable.
Get all the child embedded documents that are flagged as cascadable .
def cascadable_children(kind, children = Set.new)
      embedded_relations.each_pair do |name, association|
        next unless association.cascading_callbacks?
        without_autobuild do
          delayed_pulls = delayed_atomic_pulls[name]
          delayed_unsets = delayed_atomic_unsets[name]
          children.merge(delayed_pulls) if delayed_pulls
          children.merge(delayed_unsets) if delayed_unsets
          relation = send(name)
          Array.wrap(relation).each do |child|
            next if children.include?(child)
            children.add(child) if cascadable_child?(kind, child, association)
            child.send(:cascadable_children, kind, children)
          end
        end
      end
      children.to_a
    end
def cascadable_children ( kind , children = Set . new ) embedded_relations . each_pair do | name , association | next unless association . cascading_callbacks? without_autobuild do delayed_pulls = delayed_atomic_pulls [ name ] delayed_unsets = delayed_atomic_unsets [ name ] children . merge ( delayed_pulls ) if delayed_pulls children . merge ( delayed_unsets ) if delayed_unsets relation = send ( name ) Array . wrap ( relation ) . each do | child | next if children . include? ( child ) children . add ( child ) if cascadable_child? ( kind , child , association ) child . send ( :cascadable_children , kind , children ) end end end children . to_a end
Get all the child embedded documents that are flagged as cascadable.
Get all the child embedded documents that are flagged as cascadable .
None
 Array<Document> 
kind
<not_specific>
children
<not_specific>
new
<not_specific>
<not_specific>
kind The type of callback.
kind The type of callback .
example
Get all the cascading children. document.cascadable_children(:update)
Get all the cascading children . document . cascadable_children ( : update )