类:Mongoid::Association::Embedded::EmbeddedIn::Proxy
- 定义于:
- lib/mongoid/association/embedded/embedded_in/proxy.rb
Overview
embedded_in 关联的透明代理。 对子文档调用关联 getter 方法时,会返回此类的实例。 该类继承自 Mongoid::Association::Proxy ,并将其大部分方法转发给关联的目标,即父文档。
常量摘要
从Proxy继承的常量
实例属性摘要
从Proxy继承的属性
#_association 、 #_base 、 #_target
类方法摘要折叠
-
。 Eager_Loader (associations, Docs ) ⇒ Mongoid::Association::Embedded::Eager
返回此关联的热切加载器。
-
。嵌入式? ⇒ true
如果关联为嵌入式关联,则返回 true。
-
。路径(文档)→ 根
获取所提供文档的路径计算器。
实例方法摘要折叠
-
#initialize (base, target,association) ⇒ In
构造函数
实例化一个新的 embedded_in 关联。
-
#替换(replacement) ⇒ 文档 | nil
用提供的目标文档替换关联中的现有文档。
从One继承的方法
#__evolve_object_id__ 、 #clear 、 #in_memory 、 #respond_to?
从Proxy继承的方法
apply_ordering 、 #extend_proxies 、 #klass 、 #reset_unloaded 、 #substitutable
包含在封送处理中的方法
构造函数详情
#initialize (base, target,association) ⇒ In
实例化一个新的 embedded_in 关联。
24 25 26 27 28 29 |
# File 'lib/mongoid/association/embedded/embedded_in/proxy.rb', line 24 def 初始化(基础, 目标, 关联) 超 do characterize_one(_target) bind_one end end |
类方法详细信息
。 Eager_Loader (associations, Docs ) ⇒ Mongoid::Association::Embedded::Eager
返回此关联的热切加载器。
95 96 97 |
# File 'lib/mongoid/association/embedded/embedded_in/proxy.rb', line 95 def Eager_Loader(关联, docs) Eager.new(关联, docs) end |
。嵌入式? ⇒ true
如果关联为嵌入式关联,则返回 true。 在这种情况下始终为 true。
106 107 108 |
# File 'lib/mongoid/association/embedded/embedded_in/proxy.rb', line 106 def true end |
实例方法详细信息
#替换(replacement) ⇒文档| nil
用提供的目标文档替换关联中的现有文档。
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/mongoid/association/embedded/embedded_in/proxy.rb', line 40 def 替换(替换) unbind_one 除非 替换 _base.删除 if 持久化? return nil end _base.new_record = true 替换 = 工厂.构建(klass, 替换) if 替换.is_a?(::哈希) self._target = 替换 bind_one self end |