Hi Peter,<br><br>My table contains multiple roots using scope. I've never really called .root on the class.<br>I've sometimes wanted to find the root of an instance by calling my_instance.root to return <br>the top-most ancestor or my_instance.<br>
<br>Also - looking at the comments of .root in the SingletonMethods module - there's this info...<br><br><span style="font-family: courier new,monospace;"> # Returns the single root for the class (or just the first root, if there are several).</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> # Deprecation note: the original acts_as_nested_set allowed roots to have parent_id = 0,</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> # so we currently do the same. This silliness will not be tolerated in future versions, however.</span><br style="font-family: courier new,monospace;">
<br>I hope this is helpful to you. <br><br>-Stephen<br><br><div class="gmail_quote">On Fri, Apr 4, 2008 at 1:31 PM, Peter Schrammel <<a href="mailto:peter.schrammel@gmx.de">peter.schrammel@gmx.de</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I'm trying to get the root of a scoped set but all I get is:<br>
<br>
r=Album.root(:user_id=>4)<br>
ArgumentError: Unknown key(s): user_id<br>
<br>
My code is quite simple:<br>
<br>
class Album < ActiveRecord::Base<br>
acts_as_nested_set :scope => :user<br>
end<br>
<br>
The db has a user_id column and the columns BNS needs (parent_id,lft,rgt).<br>
<br>
I'm useing the svn trunk of today. Any tips (I hope the bug is between<br>
my ears)?<br>
<br>
<br>
Thanks,<br>
<br>
Peter<br>
_______________________________________________<br>
Betternestedset-talk mailing list<br>
<a href="mailto:Betternestedset-talk@rubyforge.org">Betternestedset-talk@rubyforge.org</a><br>
<a href="http://rubyforge.org/mailman/listinfo/betternestedset-talk" target="_blank">http://rubyforge.org/mailman/listinfo/betternestedset-talk</a><br>
</blockquote></div><br>