类:Mongoid::Association::Embedded::EmbedsOne::Binding
- 继承:
-
对象
- 对象
- Mongoid::Association::Embedded::EmbedsOne::Binding
- 包括:
- Bindable
- 定义于:
- lib/mongoid/association/embedded/embeds_one/bounding.rb
Overview
所有 embeds_one 关联的绑定类。
实例属性摘要
Bindable中包含的属性
#_association 、 #_base 、 #_target
实例方法摘要折叠
-
# bind_one ⇒ 对象
将基础对象绑定到关联的反向对象。
-
# unbind_one ⇒ 对象
通过将引用设置为 nil 来解除基础对象和反向对象的绑定。
Bindable中包含的方法
实例方法详细信息
# bind_one ⇒对象
将基础对象绑定到关联的反向对象。 这样我们就可以在两侧引用实际对象本身。
这种情况会在反向对象以及文档本身上设置关联元数据。
22 23 24 25 26 27 |
# File 'lib/mongoid/association/embedded/embeds_one/ Binding.rb', line 22 def bind_one _target.将(_base) 绑定 do try_method(_target, _association.inverse_setter(_target), _base) end end |
# unbind_one ⇒对象
通过将引用设置为 nil 来解除基础对象和反向对象的绑定。
35 36 37 38 39 |
# File 'lib/mongoid/association/embedded/embeds_one/ Binding.rb', line 35 def unbind_one 绑定 do try_method(_target, _association.inverse_setter(_target), nil) end end |