Guys, I''m having a problem getting acts_as_tree working. It seems from the Agile book (p. 255) that acts_as_tree only supports one-to-one record relations, whereas I need many-to-many support. In other words, looking at the picture at the top of page 256 where where only 1 id is linked to 1 parent_id, I need multiple id''s linked to multiple parent_id''s - for example, id = 6 linked to not only parent_id 3, but also parent_id 7 and 5 (not really parents, just linked). Obviously w/the id column being a primary key, duplicate values of id = 6 isn''t going to work. Any suggestions on getting this to work? -- Posted via http://www.ruby-forum.com/.
On 08 Feb 2006, at 20:27, Peter Jagielski wrote:> Guys, > > I''m having a problem getting acts_as_tree working. It seems from the > Agile book (p. 255) that acts_as_tree only supports one-to-one record > relations, whereas I need many-to-many support. In other words, > looking > at the picture at the top of page 256 where where only 1 id is > linked to > 1 parent_id, I need multiple id''s linked to multiple parent_id''s - for > example, id = 6 linked to not only parent_id 3, but also parent_id > 7 and > 5 (not really parents, just linked). Obviously w/the id column > being a > primary key, duplicate values of id = 6 isn''t going to work. > > Any suggestions on getting this to work?Recipe 7 in the Rails Recipes Beta book will help you out on this one: Self-referential Many-to-Many Relationships. Even in this early stage, the book is well worth its price. Best regards Peter De Berdt
Apparently Analagous Threads
- Many to Many Category structure with itself
- Using set_primary_key breaks acts_as_tree with non-integer column
- acts_as_tree and traversing parent/child relationships
- acts_as_tree, acts_as_list and is invincible (help!)
- acts_as_tree & acts_as_list for a single model?