# Why doesn't acts\_as\_tree support :scope?

**URL:** <https://www.ruby-forum.com/t/why-doesnt-acts-as-tree-support-scope/57646>\
**Category:** Rails\
**Created:** [April 12, 2006, 7:59pm UTC](https://www.ruby-forum.com/t/why-doesnt-acts-as-tree-support-scope/57646 "2006-04-12T19:59:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 12, 2006, 7:59pm UTC](https://www.ruby-forum.com/t/why-doesnt-acts-as-tree-support-scope/57646/1 "2006-04-12T19:59:07Z")

</div>

I want to implement a unique category tree per user in my system, and I  
was hoping to use “acts\_as\_tree” on my category model. It seems as if  
acts\_as\_tree makes the assumption that the entire table the model is off  
of is one large tree. I actually want each user to have their own  
category trees all stored in the category table so I need it to scope  
off of the user\_id.

acts\_as\_list supports the scope idea. Am I missing something simple?

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 14, 2006, 5:31pm UTC](https://www.ruby-forum.com/t/why-doesnt-acts-as-tree-support-scope/57646/2 "2006-04-14T17:31:32Z")

</div>

I tried acts\_as\_tree in combination with scope a while ago and it  
definitly worked. There were no tricks or obstacles, although if I  
remember correctly I misunderstood the API doc or some example I found.  
Just a

acts\_as\_tree :scope =\> “tree\_id”

was sufficiant. Of course I had to pass tree\_id with every save. Calling  
parent afterwards made the whole thing working for me.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 14, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/why-doesnt-acts-as-tree-support-scope/57646/3 "2006-04-14T17:44:14Z")

</div>

Mike B wrote:

> I want to implement a unique category tree per user in my system, and I  
> was hoping to use “acts\_as\_tree” on my category model. It seems as if  
> acts\_as\_tree makes the assumption that the entire table the model is off  
> of is one large tree. I actually want each user to have their own  
> category trees all stored in the category table so I need it to scope  
> off of the user\_id.
> 
> acts\_as\_list supports the scope idea. Am I missing something simple?

cccccccccc
