类:Mongoid::Atomic::Paths::Embedded::Many
- 继承:
-
对象
- 对象
- Mongoid::Atomic::Paths::Embedded::Many
- 定义于:
- lib/mongoid/atomic/paths/embedded/many.rb
Overview
此类封装了查找和更新定义为嵌入式1 -n 的文档的行为。
实例属性摘要
Mongoid::Atomic::Paths::Embedded中包含的属性
#delete_modifier, #document, #insert_modifier, #parent
类方法摘要折叠
-
。 position_ without_document (parent,association) ⇒ string
获取文档Go给定关联的位置。
实例方法摘要折叠
-
#initialize (文档) ⇒ Many
构造函数
创建新的路径实用程序。
-
#位置⇒ string
获取文档在层次结构中的位置。
Mongoid::Atomic::Paths::Embedded中包含的方法
构造函数详情
#initialize (文档) ⇒ Many
创建新的路径实用程序。
20 21 22 23 |
# File 'lib/mongoid/atomic/paths/embedded/many.rb', line 20 def 初始化(文档) @document, @parent = 文档, 文档._parent @insert_modifier, @delete_modifier =" $push ", " $pull " end |
类方法详细信息
。 position_ without_document (parent,association) ⇒ string
获取文档Go给定关联的位置。 此函数的使用案例是尝试为嵌入式关联保留空列表。 所有用于获取存储文档存储文档,我们没有这样做。
52 53 54 55 |
# File 'lib/mongoid/atomic/paths/embedded/many.rb', line 52 def position_ without_document(父项, 关联) pos = 父项.atomic_position " #{ pos} #{ ". " 除非 pos.blank?} #{ association.store_as} " end |
实例方法详细信息
#位置⇒ string
获取文档在层次结构中的位置。 这将包括可能位于嵌入式关联之上的1 -n 嵌入式关联的索引。
33 34 35 36 37 |
# File 'lib/mongoid/atomic/paths/embedded/many.rb', line 33 def Position pos = 父项.atomic_position 定位器 = 文档.new_record? ? " " : " . #{ 文档 ._index } } " " #{ pos } #{ " . " 除非 pos .blank? } } #{ document . _association . store_as } #{ locator } " end |