From: Stephen Schor Date: 2008-01-15T08:33:20+09:00 Subject: Multiple Trees in a better_nested_set Table. ------=_Part_10796_29300960.1200353606809 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi All, I also sent this message out to the better_nested_set mailing list so I'll update this thread if that yields a response. I'm having trouble configuring a table to be able to accommodate multiple trees. I have a feeling that this is a common question but a few creative searches came up empty. I tried using http://wiki.rubyonrails.org/rails/pages/BetterNestedSet as a guide and created a tree_id column in my table and declared acts_as_nested_set, :scope => :tree_id in my model. My rspec tests began failing and reporting the MYSQL error below: *Mysql::Error: #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? ? "tree_id IS NULL" : "tree_id = #{tree_id}" AND (parent_id IS NULL)) ORDER B' at line 1: SELECT * FROM studies WHERE (tree_id.nil? ? "tree_id IS NULL" : "tree_id = #{tree_id}" AND (parent_id IS NULL)) ORDER BY lft * Any insight is greatly appreciated. I guess I'm a bit hazy on what :scope is used for and how to use it. I've also played around with making multiple trees without :scope in my directive and it most of my method calls ended up looking like I'd expect. (.root? and .root got weird on me) -Thanks! Stephen ------=_Part_10796_29300960.1200353606809--