Would you not use..<br><br>user.albums.root() <br><br>?<br><br><div class="gmail_quote">On Fri, Apr 4, 2008 at 3:31 PM, Peter Schrammel &lt;<a href="mailto:peter.schrammel@gmx.de">peter.schrammel@gmx.de</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks Stephen<br>
<br>
but if you look at the code further down:<br>
def root(scope = {})<br>
&nbsp;find_in_nested_set(:first, { :conditions =&gt;<br>
&quot;(#{prefixed_parent_col_name} IS NULL OR #{prefixed_parent_col_name} =<br>
0)&quot; }, scope)<br>
end<br>
<br>
So the so called inner_scope is set to the scope I pass. But then<br>
somewhere in find_in_nested_set it throws the error...sigh.<br>
<br>
Nobody ever needed the root of a scope (I have only one per scope)?<br>
<br>
<br>
Stephen Schor schrieb:<br>
<div class="Ih2E3d">&gt; Hi Peter,<br>
&gt;<br>
&gt; My table contains multiple roots using scope. I&#39;ve never really called<br>
&gt; .root on the class.<br>
&gt; I&#39;ve sometimes wanted to find the root of an instance by calling<br>
&gt; my_instance.root to return<br>
&gt; the top-most ancestor or my_instance.<br>
&gt;<br>
&gt; Also - looking at the comments of .root in the SingletonMethods module -<br>
&gt; there&#39;s this info...<br>
&gt;<br>
&gt; &nbsp; # Returns the single root for the class (or just the first root, if<br>
&gt; there are several).<br>
&gt; &nbsp; # Deprecation note: the original acts_as_nested_set allowed roots to<br>
&gt; have parent_id = 0,<br>
&gt; &nbsp; # so we currently do the same. This silliness will not be tolerated in<br>
&gt; future versions, however.<br>
&gt;<br>
&gt; I hope this is helpful to you.<br>
&gt;<br>
<br>
</div><div><div></div><div class="Wj3C7c">_______________________________________________<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>
</div></div></blockquote></div><br>