Module: Mongoid::Hierarchy
- Defined in:
- lib/mongoid/core_ext/hierarchy.rb
Instance Method Summary collapse
-
#collect_children ⇒ Array<Document>
Collect all the children of this document.
Instance Method Details
#collect_children ⇒ Array<Document>
Collect all the children of this document.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mongoid/core_ext/hierarchy.rb', line 11 def collect_children children = [] .each_pair do |name, | without_autobuild do child = send(name) Array.wrap(child).each do |doc| children.push(doc) children.concat(doc._children) unless .versioned? end if child end end children end |