Oliver Paulus
2006-May-10 18:28 UTC
[Rails] acts_as_nested_set does not work (in my case).
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? -- Posted via http://www.ruby-forum.com/.
Adrian Madrid
2006-May-11 04:25 UTC
[Rails] acts_as_nested_set does not work (in my case).
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 On 5/10/06, Oliver Paulus <oliver@code-project.org> wrote:> > 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? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Adrian Esteban Madrid -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060511/4a7b8efe/attachment.html