Forum: Ruby on Rails acts_as_tree?? Heirarchy needed

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.
9f9c3cd0120e224edb912be6e706f125?d=identicon&s=25 Iain Adams (Guest)
on 2008-12-10 13:10
(Received via mailing list)
Hello,

I have a problem that I thought I could solve with acts_as_tree but
I'm thinking now that acts_as_tree doesn't quite fit the bill.

Basically I have a standard hierarchy with 1 difference:

Node 1
       \ Leaf 1
       \ Node 2
                    \ Leaf 2
                    \ Node 3
                                 \ Leaf 3
                                 \ Link back to Node 3 **** HARD BIT
****
                                 \ Node 4
                                              \ Leaf 4
                                              \ Leaf 5

The problem is Node 3's parent is Node 2 so linking back to Node 3 is
impossible.

i.e

node3.children.create(node5)
node5.children << node 3      -- This will cause node3's parent_id be
node5 and not node 2

Can anyone think of a way to do this??

Thanks

Iain
This topic is locked and can not be replied to.