类:Mongoid::Association::Referenced::BelongsTo::Proxy
- 包括:
- 可演进
- 定义于:
- lib/mongoid/association/referenced/belongs_to/proxy.rb
Overview
Belong_to 关联的透明代理。 对主题文档调用关联 getter 方法时,将返回此类的实例。 该类继承自 Mongoid::Association::Proxy,并将其大部分方法转发到关联的目标,即必须加载的对方集合上的文档。
常量摘要
从Proxy继承的常量
实例属性摘要
从Proxy继承的属性
#_association 、 #_base 、 #_target
类方法摘要折叠
-
。 Eager_Loader (association, Docs ) ⇒ Mongoid::Association::Referenced::BelongsTo::Eager
获取此类关联的 Eager对象。
-
。嵌入式? ⇒ false
如果关联为嵌入式关联,则返回 true。
实例方法摘要折叠
-
#initialize (base, target,association) ⇒ 代理
构造函数
实例化一个新的 belongs_to 关联代理。
-
# nullify ⇒ 对象
通过删除外键和引用来删除基本文档和目标文档之间的关联,并在此进程中孤立目标文档。
-
#替换(替换) ⇒ self | nil
用提供的目标文档替换关联中的现有文档。
包含在Evolvable中的方法
从One继承的方法
#__evolve_object_id__ 、 #clear 、 #in_memory 、 #respond_to?
从Proxy继承的方法
apply_ordering 、 #extend_proxies 、 #klass 、 #reset_unloaded 、 #substitutable
包含在封送处理中的方法
构造函数详情
#initialize (base, target,association) ⇒代理
实例化一个新的 belongs_to 关联代理。
26 27 28 29 30 31 |
# File 'lib/mongoid/association/referenced/belongs_to/proxy.rb', line 26 def 初始化(基础, 目标, 关联) 超 do characterize_one(_target) bind_one end end |
类方法详细信息
。 Eager_Loader (association, Docs ) ⇒ Mongoid::Association::Referenced::BelongsTo::Eager
获取此类关联的 Eager对象。
110 111 112 |
# File 'lib/mongoid/association/referenced/belongs_to/proxy.rb', line 110 def Eager_Loader(关联, docs) Eager.new(关联, docs) end |
。嵌入式? ⇒ false
如果关联为嵌入式关联,则返回 true。 在这种情况下始终为 false。
121 122 123 |
# File 'lib/mongoid/association/referenced/belongs_to/proxy.rb', line 121 def false end |
实例方法详细信息
# nullify ⇒对象
通过删除外键和引用来删除基本文档和目标文档之间的关联,并在此进程中孤立目标文档。
39 40 41 42 |
# File 'lib/mongoid/association/referenced/belongs_to/proxy.rb', line 39 def nullify unbind_one _target.保存 end |
#替换(替换) ⇒ self | nil
用提供的目标文档替换关联中的现有文档。
53 54 55 56 57 58 59 60 |
# File 'lib/mongoid/association/referenced/belongs_to/proxy.rb', line 53 def 替换(替换) unbind_one return 除非 替换 self._target = 规范化(替换) bind_one self end |