closure_tree icon indicating copy to clipboard operation
closure_tree copied to clipboard

A method for checking if an object is an intermediate object between root and leaf?

Open AlexVPopov opened this issue 11 years ago • 0 comments

I have a multi-level tag hierarchy and I happened to need to know if a tag is a parent of sub-tags, but not a root. I ended up adding this to the Tag model:

def intermediate?
  !self.root? && !self.leaf?
end

I think that something similar would be a good idea as an instance method in the gem.

AlexVPopov avatar Dec 10 '14 13:12 AlexVPopov