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
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 <wschenk at gmail.com> 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 > >
I was at RailsConf Berlin and they were saying that they have a new process to get patches in. I need to look up the info in more detail, but basically you need to have each patch verified by at least three people and it gets onto "Report 12". I think that if we all hammer out something here and we''re all happy with it, and especially figure out how to make it compatible with the old one it won''t be an issue. I like the idea of having an easy-to-use API built on top of something more powerful than what is currently in core. I think with 3 people working on this here (if Jean Christophe is interested) we should have no problems. -w On Sep 30, 2007, at 11:32 PM, Krishna Dole wrote:> 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 <wschenk at gmail.com> 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 >> >> > _______________________________________________ > Betternestedset-talk mailing list > Betternestedset-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/betternestedset-talkWill Schenk wschenk at gmail.com http://sublimeguile.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/betternestedset-talk/attachments/20071001/5f4f5eca/attachment.html
On 10/1/07, Will Schenk <wschenk at gmail.com> wrote:> I was at RailsConf Berlin and they were saying that they have a new process > to get patches in. I need to look up the info in more detail, but basically > you need to have each patch verified by at least three people and it gets > onto "Report 12". I think that if we all hammer out something here andhttp://weblog.rubyonrails.com/2007/9/15/how-to-get-a-patch-into-rails -Tim
I am not quite ready to write/improve plugins myself. But I am getting there. If you guys want an alpha tester, I could try out the new integrated plugin and try to generate good issue reports. Actually, I have a design question/suggestion for the current betternestedset. Quoting Will Schenk <wschenk at gmail.com>:> 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.)Why is setting of parent_id directly prohibited? I have a before_save filter that needs information from parent_id to work, but I can''t set it in the object. Wills post reminded me of the add_child method, so I checked to see if that would prevent me having to do 3 saves to create my object (the original save, the move_to_child_of save, and then an additional, gratuitous save to get my filter to run), but I couldn''t actually get it to work at all. If it is neccessary to protect setting parent_id, is it possible to put in some sort of registered callbacks? I am thinking of the code I noticed in attachment_fu that lets you configure a block that is called before a thumbnail is saved. It made it really easy for me to add some metadata to the automatically generated thumbnails before they were saved to the database. Example: before_thumbnail_saved do |record, thumbnail| thumbnail.title = record.title thumbnail.description = record.description thumbnail.user_id = record.user_id end -- Cynthia Kiser
Hi, Thanks Krishna for your summary ! I''m quite busy these days and won''t be able to improve BNS just now, but I plan to continue to use it and I agree that merging is a good idea. Le 1 oct. 07 ? 17:05, Will Schenk a ?crit : I was at RailsConf Berlin and they were saying that they have a new process to get patches in. I need to look up the info in more detail, but basically you need to have each patch verified by at least three people and it gets onto "Report 12". I think that if we all hammer out something here and we''re all happy with it, and especially figure out how to make it compatible with the old one it won''t be an issue. I like the idea of having an easy-to-use API built on top of something more powerful than what is currently in core. I think with 3 people working on this here (if Jean Christophe is interested) we should have no problems. Will, can you tell us wether the plugin you wrote is linked to core now ? is it completely independant or no ? Jean-Christophe Michel -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/betternestedset-talk/attachments/20071004/741b362c/attachment.html