# \[ANN\] acts\_as\_materialized\_tree

**URL:** <https://www.ruby-forum.com/t/ann-acts-as-materialized-tree/154152>\
**Category:** Rails\
**Created:** [November 25, 2008, 10:31pm UTC](https://www.ruby-forum.com/t/ann-acts-as-materialized-tree/154152 "2008-11-25T22:31:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stickstone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/6f9a4e/32.png) [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Post date:** [November 25, 2008, 10:31pm UTC](https://www.ruby-forum.com/t/ann-acts-as-materialized-tree/154152/1 "2008-11-25T22:31:10Z")

</div>

I have made an experimental implementation of materialized trees for  
ActiveRecord.

In a materialized tree, each node contains an explicit path attribute.  
This allows for efficient subtree searches [expensive in acts\_as\_tree]  
and insertion and removal of children [expensive in acts\_as\_nested\_set]

This should be considered proof-of-concept rather than production-ready  
code. Requires ActiveRecord 2.1.x or later, as it makes extensive use of  
anonymous scopes.

Code: git clone git://rubyforge.org/acts-as-matree.git  
Docs: [http://acts-as-matree.rubyforge.org/](http://acts-as-matree.rubyforge.org/)

Regards,

Brian C…
