Forum: Ruby on Rails acts_as_nested_set does not work (in my case).

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D39d7c8071ed8bed6b851c64697b1a29?d=identicon&s=25 Oliver Paulus (paoli)
on 2006-05-10 20:27
Hello,

I am using acts_as_nested_set. My problem is that the columns "lft" and
"rgt" get the value 0 if I create a new entity. If I delete an entity I
get negative values (-1, -2, -3) - but for all entities. Is there
anything missing? Is there any example for "acts_as_nested_set" in the
web?
67d3880bbfaafdb2a2108b7c9a64df47?d=identicon&s=25 Adrian Madrid (Guest)
on 2006-05-11 06:27
(Received via mailing list)
Oliver,

When you create a new object it does not kick in. It does when you add a
child to another object. Then the nested set can actually work its
magic.

p = Category.create :title => "Parent"
c = Category.create :title => "Child"
p.add_child c

p.lft --> 1
p.rgt --> 4
c.lft --> 2
c.rgt --> 3

Hope that helps,


Adrian Madrid
This topic is locked and can not be replied to.