module Xylem::ClassMethods

Public Instance Methods

leaves() click to toggle source
# File lib/xylem.rb, line 70
def leaves
  where.not(id: select(:parent_id).where.not(parent_id: nil))
end
root() click to toggle source
# File lib/xylem.rb, line 62
def root
  roots.first
end
roots() click to toggle source
# File lib/xylem.rb, line 66
def roots
  where(parent: nil)
end