Forum: Ruby on Rails Why doesn't acts_as_tree support :scope?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A3ff521fa0b827d6f5d5e31311fcbd46?d=identicon&s=25 Mike B (Guest)
on 2006-04-12 19:59
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?
8d30b78dcd3ae8ff8d5e6085059060c7?d=identicon&s=25 Martin Bernd Schmeil (thebernd)
on 2006-04-14 17:31
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.
1822db65dd7c80491315c9fbcd314996?d=identicon&s=25 Yang Chen (td919)
on 2006-04-14 17:44
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
This topic is locked and can not be replied to.