Module: Mongoid::Document

Included in:
Workarea::ApplicationDocument, Workarea::Metrics::ByDay, Workarea::Metrics::ProductForLastWeek, Workarea::Metrics::SearchForLastWeek, Workarea::Metrics::User
Defined in:
lib/workarea/ext/mongoid/lookup_hash.rb,
lib/workarea/ext/mongoid/embedded_children.rb,
lib/workarea/ext/freedom_patches/mongoid_simple_tags.rb

Defined Under Namespace

Modules: Taggable

Instance Method Summary collapse

Instance Method Details

#embedded_childrenArray<Mongoid::Document>

Returns all the embedded children in this document by recursion.

Returns:



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/workarea/ext/mongoid/embedded_children.rb', line 7

def embedded_children
  result = []

  embedded_relations.each do |name, |
    Array.wrap(send(name)).each do |child|
      result << child
      result += child.embedded_children
    end
  end

  result
end