Sha256: 8839b8d5c2ccabfaf45a8523aad7a72b283bfe8a021e8afe4b398a380a5bbd58

Contents?: true

Size: 423 Bytes

Versions: 27

Compression:

Stored size: 423 Bytes

Contents

module Mongoid
  module Document
    # Returns all the embedded children in this document by recursion.
    #
    # @return [Array<Mongoid::Document>]
    #
    def embedded_children
      result = []

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

      result
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
workarea-core-3.5.27 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.26 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.25 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.23 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.22 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.21 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.20 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.19 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.18 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.17 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.16 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.15 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.14 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.13 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.12 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.11 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.10 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.9 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.8 lib/workarea/ext/mongoid/embedded_children.rb
workarea-core-3.5.7 lib/workarea/ext/mongoid/embedded_children.rb