Sha256: f5cff9abfb9f483d626b4645c72423da4360150c7e329779f6055cf942090522
Contents?: true
Size: 866 Bytes
Versions: 9
Compression:
Stored size: 866 Bytes
Contents
# encoding: utf-8 module Mongoid module Relations module Builders module Referenced class Many < Builder # This builder either takes a hash and queries for the # object or an array of documents, where it will just return tem. # # @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 unless query? return [] if object.is_a?(Array) crit = metadata.criteria(Conversions.flag(object, metadata), base.class) IdentityMap.get_many(crit.klass, crit.send(:selector_with_type_selection)) || crit end end end end end end
Version data entries
9 entries across 9 versions & 4 rubygems