Forum: Ruby on Rails Many-To-Many w/acts_as_tree?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6cf3e18ebc948992a4cbe83330496e36?d=identicon&s=25 Peter Jagielski (sweetpete)
on 2006-02-08 20:27
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?
00973881979aa0a660ffbbb2f7a907fb?d=identicon&s=25 Peter De Berdt (Guest)
on 2006-02-08 22:41
(Received via mailing list)
On 08 Feb 2006, at 20:27, Peter Jagielski wrote:

> 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
This topic is locked and can not be replied to.