end
end
end
+
+module CollectiveIdea
+ module Acts
+ module NestedSet
+ module Model
+ def leaf_with_new_record?
+ new_record? || leaf_without_new_record?
+ end
+ alias_method_chain :leaf?, :new_record
+ end
+ end
+ end
+end
# Returns true if this is the end of a branch.
def leaf?
- new_record? || (persisted? && right.to_i - left.to_i == 1)
+ persisted? && right.to_i - left.to_i == 1
end
# Returns true is this is a child node
:enumerations,
:issues
+ def test_new_record_is_leaf
+ i = Issue.new
+ assert i.leaf?
+ end
+
def test_create_root_issue
issue1 = Issue.generate!
issue2 = Issue.generate!