Sha256: b59328531c5df7f703a0651deb5fff8c1eec42a68853a74350cf5db2df9e46b9
Contents?: true
Size: 742 Bytes
Versions: 55
Compression:
Stored size: 742 Bytes
Contents
# encoding: utf-8 module Mongoid module Relations module Builders module Referenced class In < Builder # This builder either takes a foreign key and queries for the # object or a document, where it will just return it. # # @example Build the document. # Builder.new(meta, attrs).build # # @param [ String ] type The type of document to query for. # # @return [ Document ] A single document. def build(type = nil) return object unless query? model = type ? type.constantize : metadata.klass metadata.criteria(object, model).first end end end end end end
Version data entries
55 entries across 50 versions & 3 rubygems