2013-06-27 2 views

답변

8
taxon_products = current_taxon.products 
children_products = current_taxon.children.includes(:products).map(&:products). 
            flatten.compact.uniq 
1

만 아이들의 한 레벨을 검색해야하는 경우 @PinnyM에 의한 대답은 괜찮지 만, 당신은 분류군에 따라 모든 제품을 찾으려면,이 같은 the in_taxon scope 사용할 수 있습니다

children_products = Spree::Product.in_taxon(current_taxon)