模块:Mongoid::Association::Embedded::EmbedsOne::Buildable
- 定义于:
- lib/mongoid/association/embedded/embeds_one/buildable.rb
Overview
embeds_one 关联的构建器类。
实例方法摘要折叠
-
# build (base, object, _type = nil, Selected_fields = nil) ⇒ 文档
使用提供的关联元数据,根据属性构建文档。
实例方法详细信息
# 构建 (base, 对象, _type = nil, Selected_fields = nil) ⇒文档
使用提供的关联元数据,根据属性构建文档。 通过工厂实例化,以确保在合适的情况下使用子类和分配。
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mongoid/association/embedded/embeds_one/buildable.rb', line 28 def 构建(基础, 对象, _type = nil, created_fields = nil) if 对象.is_a?(哈希) if _loading? && 基础.持续存在? 工厂.execute_from_db(klass, 对象, nil, created_fields, execute_callbacks: false) else 工厂.构建(klass, 对象) end else clear_关联(对象) 对象 end end |