Skip to content

Commit

Permalink
Descendants for categories
Browse files Browse the repository at this point in the history
  • Loading branch information
nbudin committed Dec 29, 2011
1 parent af662ec commit 5a6c241
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ntee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ def ancestors
end
end

def descendants
(subcategories + subcategories.map(&:descendants)).flatten
end

def add_subcategory!(subcategory)
subcategories[subcategory.code.to_s] = subcategory
subcategory.parent = self
Expand Down

0 comments on commit 5a6c241

Please sign in to comment.