We are pleased to announce the 0.1 release of the plugin betternestedset. It greatly enhances ActiveRecord's internal acts_as_nested_set.
Install it with: script/plugin install svn://rubyforge.org/var/svn/betternestedset/tags/stable/betternestedset
Join the mailing list: http://rubyforge.org/mailman/listinfo/betternestedset-talk
Report bugs: http://opensource.symetrie.com/trac/better_nested_set/
A nested set is a smart way to implement an ordered tree that allows for fast, non-recursive queries. For example, you can fetch all descendants of a node in a single query, no matter how deep the tree. The drawback is that insertions/moves/deletes require complex SQL, but that is handled behind the curtains by this plugin!
Nested sets are appropriate for ordered trees (e.g. menus, commercial categories) and large trees that must be queried efficiently (e.g. threaded posts). Nested sets provide greatly improved read performance at the cost of reduced write performance, which is a worthwhile trade for most web applications.
Migrating from an ordinary adjacency list tree (such as acts_as_tree) is not complex, particularly if your table contains only a single tree.
NOTE: This 0.1 release will be the only one fully backwards-compatible with the original acts_as_nested_set. The add_child method will be dropped in the future, and the possibility of having a root defined by parent_id == 0 will be removed.
Milestones: 0.2 will add ... A promising branch is being built by Krishna Dole to provide an even simpler API, closer to that of acts_as_tree. Grab it from svn://rubyforge.org/var/svn/betternestedset/branches/ez-set and test it out.
betternestedset is brought up to you by Jean-Christophe Michel, greatly helped by Krishna Dole and other contributors.
Jean-Christophe Michel