lib/mongoid/association/referenced/has_one/buildable.rb in mongoid-7.0.13 vs lib/mongoid/association/referenced/has_one/buildable.rb in mongoid-7.1.0.rc0
- old
+ new
@@ -1,6 +1,8 @@
+# frozen_string_literal: true
# encoding: utf-8
+
module Mongoid
module Association
module Referenced
class HasOne
@@ -11,11 +13,16 @@
# This method either takes an _id or an object and queries for the
# inverse side using the id or sets the object after clearing the
# associated object.
#
+ # @param [ Object ] base The base object.
+ # @param [ Object ] object The object to use to build the association.
+ # @param [ String ] type The type of the association.
+ # @param [ nil ] selected_fields Must be nil.
+ #
# @return [ Document ] A single document.
- def build(base, object, type = nil)
+ def build(base, object, type = nil, selected_fields = nil)
if query?(object)
if !base.new_record?
execute_query(object, base)
end
else