0
我已经定义了以下范围(在我的模型中)来帮助我过滤出某些不需要的嵌套数据。使用红宝石mongoid gem过滤嵌套属性
scope :active_inactive, -> { self.in({
state: ["current"],
"events.type" => [
:active,
:inactive,
]
}).desc(:created_at)
}
当我运行这个时,我得到的结果是包含像这个范围不应该包含的“in_progress”其他事件。
几乎有@vitali –