0
주문 나는 다음과 같은 한 종류 모델 : 내가 Category.all를 호출 할 때 반환 이제Mongoid :: 트리
Root 1
Leaf 1
Subleaf 1
Leaf 2
Root 2
Leaf 3
:
Root 1
Leaf 2
Leaf 1
Root 2
Subleaf 1
Leaf 3
class Category
include Mongoid::Document
include Mongoid::Tree
field :title, type: String
validates :title, presence: true, uniqueness: true, length: {minimum: 2}
end
나는 다음 테스트 데이터를 저장 한
하지만 다음 주문이 필요합니다.
Root 1
Leaf 1
Subleaf 1
Leaf 2
Root 2
Leaf 3