Sha256: 0c7eb4d1b7f8899dab9ca804ae49db494abf516e36cb7fae037c2f786e98b0d8
Contents?: true
Size: 839 Bytes
Versions: 8
Compression:
Stored size: 839 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.try(:dup) unless query? begin metadata.klass.find(object) rescue Errors::DocumentNotFound return [] end end end end end end end
Version data entries
8 entries across 8 versions & 3 rubygems