From rich_apodaca at yahoo.com Wed Sep 5 19:28:50 2007 From: rich_apodaca at yahoo.com (richard apodaca) Date: Wed, 5 Sep 2007 16:28:50 -0700 (PDT) Subject: [Betternestedset-talk] NoMethodError when using all_children_count on single-node set Message-ID: <810573.46495.qm@web34213.mail.mud.yahoo.com> Noob here. When I try to use methods such as all_children_count (and other methods) on a set consisting of a single node, I get the following error: NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.- from ./script/../config/../config/../vendor/plugins/betternestedset/lib/better_nested_set.rb:564:in `all_children_count' from (irb):27 I get no such error if children are present. And has_chidren? doesn't produce the error. Does anyone else see the same thing? thanks, Rich ____________________________ Richard Apodaca Blog: http://depth-first.com From robert.head at gmail.com Wed Sep 5 20:22:26 2007 From: robert.head at gmail.com (Robert Head) Date: Wed, 5 Sep 2007 17:22:26 -0700 Subject: [Betternestedset-talk] acts_as_nested_set integration Message-ID: <43e309bd0709051722s2491020l609cb3dc1ff8cb22@mail.gmail.com> What is the thinking behind maintaining a separate better_nested_set rather than integrating with the acts_as_nested_set code-base proper. In other words, getting these features directly into edge rails. If acts_as_nested_set is "broken," and better_nested_set is... well, "better" (which it clearly is), I think either the better_nested_set improvements should be wrapped into rails or acts_as_nested_set should be removed altogether. Care to shine a light on this process? Many thanks, - rob head From dontfall at gmail.com Thu Sep 6 08:39:31 2007 From: dontfall at gmail.com (Krishna Dole) Date: Thu, 6 Sep 2007 08:39:31 -0400 Subject: [Betternestedset-talk] acts_as_nested_set integration In-Reply-To: <43e309bd0709051722s2491020l609cb3dc1ff8cb22@mail.gmail.com> References: <43e309bd0709051722s2491020l609cb3dc1ff8cb22@mail.gmail.com> Message-ID: <8d64b97d0709060539w647ea4b5xeeda5e280fb2c6ff@mail.gmail.com> In a word, you're right, but I don't think AANS has been dropped from core yet. Back in the pre-Rails 1.2 days, the core team decided that several things, including AANS, should be spun off as plugins, in an effort to keep Rails proper lean and maintainable. AANS was supposed to be dropped from 1.2, but that never happened. I'm not sure if they are leaving it in 2.0, or if their thinking has changed recently. Krishna On 9/5/07, Robert Head wrote: > What is the thinking behind maintaining a separate better_nested_set > rather than integrating with the acts_as_nested_set code-base proper. > In other words, getting these features directly into edge rails. > > If acts_as_nested_set is "broken," and better_nested_set is... well, > "better" (which it clearly is), I think either the better_nested_set > improvements should be wrapped into rails or acts_as_nested_set should > be removed altogether. > > Care to shine a light on this process? > > Many thanks, > - rob head > _______________________________________________ > Betternestedset-talk mailing list > Betternestedset-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/betternestedset-talk > From tiwatson at gmail.com Fri Sep 14 11:20:58 2007 From: tiwatson at gmail.com (Tim Watson) Date: Fri, 14 Sep 2007 11:20:58 -0400 Subject: [Betternestedset-talk] Scope and polymorphic association Message-ID: <959562ce0709140820n7892826dh7c1a0cac7f9c5b96@mail.gmail.com> better_nested_set is great and a dream.. but I can't seem to wrap my head around this one, if its even at all possible... I have several models that I want to have a multi-threaded msg style comment system added to. My Comment model includes: acts_as_nested_set belongs_to :commentable, :polymorphic => true belongs_to :user So along with the standard better_nested_set fields I have commentable_id and commentable_type. Has anyone used BNS with a polymorphic table? and if so how did you handle the scoping? I tried the standard root_id .. but I'm not sure what to set the root_id as. Thanks... -timw -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/betternestedset-talk/attachments/20070914/70c02c3e/attachment.html From nigel.bris at gmail.com Sat Sep 15 22:56:10 2007 From: nigel.bris at gmail.com (Nigel Rausch) Date: Sun, 16 Sep 2007 12:56:10 +1000 Subject: [Betternestedset-talk] Searching a child set Message-ID: <8c295a860709151956k4021cfb3ybebbaaaa947bb4c2@mail.gmail.com> Hi, How can you search a child set of data eg Model.children.find(:all) Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/betternestedset-talk/attachments/20070916/f1394bb5/attachment.html From wschenk at gmail.com Sun Sep 30 11:54:35 2007 From: wschenk at gmail.com (Will Schenk) Date: Sun, 30 Sep 2007 11:54:35 -0400 Subject: [Betternestedset-talk] (no subject) Message-ID: Hi all, I wrote the original acts_as_nested_set over a weekend it looks like 2.5 years ago[1] and then sort of fell off the face of the earth. No one else has touched it as far as I can see and people seemed to have missed how to use the :scope parameter. Next time I guess I should have more documentation, though I do enjoy that my little ASCII diagram as made it around! I have need for it again and the core for original reason that I needed it is long gone and for rails 0.9 anyway. So I've been looking to see whats out there and there's acts_as_threaded and betternestedset. I can't seem to find acts_as_threaded (the url doesn't work?). My question is do we need to have two plugins for this? What exactly is better about BetterNestedSet? (I'm curious. The move_to_child_of seems more complicated to me than just saying o.add_child, but having access to the level seems nice.) Anyway, acts_as_nested_set has been moved to an official plugin at http://dev.rubyonrails.org/browser/plugins/acts_as_nested_set and it seems to me that it would be easier for everyone if we just merged the two somehow. -w [1] http://dev.rubyonrails.org/ticket/1000 Holy crap that's a while ago! Will Schenk wschenk at gmail.com http://sublimeguile.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/betternestedset-talk/attachments/20070930/3bd26334/attachment.html From dontfall at gmail.com Sun Sep 30 23:32:03 2007 From: dontfall at gmail.com (Krishna Dole) Date: Sun, 30 Sep 2007 20:32:03 -0700 Subject: [Betternestedset-talk] (no subject) In-Reply-To: References: Message-ID: <8d64b97d0709302032t263cff27xf1effaa4d0512252@mail.gmail.com> Hi Will, Nice to hear from you. In summary, I agree that the plugins should be merged, and I'm happy to help. My part of the story starts about 2 years ago. I wanted a nested set, but I needed to be able to move subtrees and add numbers to existing trees to turn them into nested sets. I modified and added to your code to do this, but didn't release my changes. A while later I discovered Jean-Christophe Michel's BetterNestedSet, which had an improved way of moving subtrees. I started working with him, adding various functionality and tests. BetterNestedSet has a number of advantages over the original. Perhaps the most important is the ability to move subtrees around. Other improvements include concurrency-safety (critical for high-traffic applications, since nested sets are so volatile), the ability to re-order siblings for acts_as_list functionality, methods for checking and re-numbering trees, and probably other important things I've forgotten. As a side note, I also wrote a modified version[1] of BNS that provides an even simpler API-- you just treat your model like an acts_as_tree, and AR callbacks handle all the nested set operations completely transparently. You can use all the methods added by belongs_to and has_many, and it just works. I still really like this idea, but I haven't had time to see how much of a performance hit it causes. I think the questions that need to be resolved before merging BNS into an official plugin are: 1) Is the core team willing to cooperate with this? I think BNS was originally created because the overworked core team didn't commit Jean-Christphe's patches. 2) There are a few minor compatibility breakages between AANS and BNS that we would likely want to look at. Does anyone else have concerns to raise? Krishna [1] svn://rubyforge.org/var/svn/betternestedset/branches/ez-set/ On 9/30/07, Will Schenk wrote: > Hi all, > > I wrote the original acts_as_nested_set over a weekend it looks like 2.5 > years ago[1] and then sort of fell off the face of the earth. No one else > has touched it as far as I can see and people seemed to have missed how to > use the :scope parameter. Next time I guess I should have more > documentation, though I do enjoy that my little ASCII diagram as made it > around! I have need for it again and the core for original reason that I > needed it is long gone and for rails 0.9 anyway. So I've been looking to > see whats out there and there's acts_as_threaded and betternestedset. I > can't seem to find acts_as_threaded (the url doesn't work?). > > My question is do we need to have two plugins for this? What exactly is > better about BetterNestedSet? (I'm curious. The move_to_child_of seems > more complicated to me than just saying o.add_child, but having access to > the level seems nice.) > > Anyway, acts_as_nested_set has been moved to an official plugin at > http://dev.rubyonrails.org/browser/plugins/acts_as_nested_set > and it seems to me that it would be easier for everyone if we just merged > the two somehow. > -w > > [1] http://dev.rubyonrails.org/ticket/1000 Holy crap > that's a while ago! > > Will Schenk > wschenk at gmail.com > http://sublimeguile.com > > _______________________________________________ > Betternestedset-talk mailing list > Betternestedset-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/betternestedset-talk > >