Module: Xylem::ClassMethods
- Defined in:
- lib/xylem.rb
Instance Method Summary collapse
Instance Method Details
#leaves ⇒ Object
70 71 72 73 |
# File 'lib/xylem.rb', line 70 def leaves t = arel_table where(t[:id].not_in(t.project([t[:parent_id]]).where(t[:parent_id].not_eq(nil)).distinct)) end |
#root ⇒ Object
62 63 64 |
# File 'lib/xylem.rb', line 62 def root roots.first end |
#roots ⇒ Object
66 67 68 |
# File 'lib/xylem.rb', line 66 def roots where(parent: nil) end |