Sha256: 267817f3ca9ba3d7941b10a5ef8a8b35b99aa2d30b004febc2b65bfe332d0923
Contents?: true
Size: 783 Bytes
Versions: 8
Compression:
Stored size: 783 Bytes
Contents
# encoding: utf-8 module Mongoid # :nodoc: module Relations #:nodoc: module Builders #:nodoc: module Referenced #:nodoc: 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? key = metadata.foreign_key metadata.klass.find(:conditions => { key => object }) end end end end end end
Version data entries
8 entries across 8 versions & 2 rubygems