Sha256: 7b44cfaeb7c8529f6bbba34a5233ec43ded86c553db4b6380db37be4bbc330fc
Contents?: true
Size: 833 Bytes
Versions: 5
Compression:
Stored size: 833 Bytes
Contents
# encoding: utf-8 module Mongoid # :nodoc: module Relations #:nodoc: module Builders #:nodoc: module Referenced #:nodoc: class ManyToMany < Builder # This builder either takes a hash and queries for the # object or an array of documents, where it will just return them. # # @example Build the documents. # Builder.new(meta, attrs).build # # @param [ String ] type The type of document to query for. # # @return [ Array<Document> ] The documents. def build(type = nil) return object.dup unless query? begin metadata.klass.find(object) rescue Errors::DocumentNotFound return [] end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems