Hey all. I''m working on a patch to add ActiveRecord::Acts::NestedSet. NestedSets are similar to trees, but more efficient when querying and less efficient when inserting/deleting. (Less efficient being 3 extra SQL statements, 2 of which are full table writes. It''s possible to get that down to 1 full table write, but I currently lack the AR chops.) NestedSets are another way to represent parent->child relationships in a database, but with the added feature that you can select all children and all of their sub children with a single query. One use case of this where you''d use NestedSet instead of Tree is if you were implementing a threaded posting system, and you''d want to display all "nested replies". Using a tree, you''d need to do a query to get all the children, and then recursively do queries to get all of their children. With a NestedSet, you get get all direct children or all nested children with a single select. I''ve documented this is more detail in the code. A patch with w/full unit tests can be found here: http://dev.rubyonrails.com/ticket/1000 ...and if you just want to browse the source which describes the theory, go here: http://myelinate.com/svn/myelinate/trunk/vendor/active_record/acts/nested_set.rb Everything works, but I''m not sure that it works in the Rails Way(tm). Specifically this is done seperately from has_many, so there you don''t get any of those functions. I''m not using the association_proxy, so everytime you get the children it''ll load them up again. If you set a slicing column (i.e. if you want to maintain more that one nestedset in the same table, which pretty much everyone was) you need to either make sure you''ve saved it or override add_child method to pull the slicing data out of the parent. So, in short, this is cool and really useful but my lack of understanding of ruby and the internals ActiveRecord make it difficult for me to polish this, and so I need other peoples help. -w -- Will Schenk http://www.sublimeguile.com http://www.myelinate.com