Ticket #37 (new enhancement)

Opened 1 year ago

Last modified 1 year ago

Added "parents" and "leaves" class methods

Reported by: rails Assigned to: jcm
Priority: minor Milestone:
Component: plugin Version:
Keywords: parents leaves class_methods doc documentation test tests coverage Cc: adambair@gmail.com

Description

Added class methods that will return all parents or leaves:

class NestedSet < ActiveRecord::Base
  acts_as_nested_set
end

NestedSet.parents # => returns all items that have children
NestedSet.leaves  # => returns all items that have no children

Test coverage and documentation included.

Please me with questions:

Adam Bair
adam@intridea.com
www.intridea.com

adambair@gmail.com
www.adambair.com

Attachments

leaves_and_parents_class_methods.patch (2.8 kB) - added by rails on 10/19/07 19:18:55.
Methods, tests, and documentation.

Change History

10/19/07 19:18:55 changed by rails

  • attachment leaves_and_parents_class_methods.patch added.

Methods, tests, and documentation.

10/19/07 19:20:46 changed by rails

The description should actually read "Please hit me with questions".

12/23/07 21:17:02 changed by rails

I just applied the patch. I'll be using the 'parents' method quite a bit. The :conditions => "rgt <> lft + 1" is familiar to me from a project I did several years ago. "parents" is a must-have method for me.