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.
Mike B (Guest)
on 2006-04-12 21: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?
Martin Bernd S. (Guest)
on 2006-04-14 19: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.
Yang C. (Guest)
on 2006-04-14 19: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.