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? -- Posted via http://www.ruby-forum.com/.
Martin Bernd Schmeil
2006-Apr-14 15:31 UTC
[Rails] Re: Why doesn''t acts_as_tree support :scope?
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. -- Posted via http://www.ruby-forum.com/.
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 -- Posted via http://www.ruby-forum.com/.