[1] Something to try first – and even if this is not part of the problem, It may help you in debugging – is to name the relationships more directly. In PeContainer, name them “parentpage” and “childpages”, etc.
[2] I think your problem might lie in the fact that in your Page model you have only declared one relationship, when really there are two. Consider the case of a Book, which has an author and an editor, both of which are People. You would declare the relationships seperately, you would not say “has many People”. Similarly, in this case you should HABTM :parent_containers and HABTM :child_containers.
Looks to me like your page model is incorrect, judging from your text
diagram. Assuming your model is a tree with alternating node types, you
probably want:
I just re-read your email and realized that I did not address the problem you stated :). But I think making your relationships more explicit is a good place to start.
I changed the Modelrelations to the settings Donald wrote. But this
didn't help.
I can't rename my models, because I have an unlimited tree. So here is
an example of what i do:
I have a page (id=1)
This page has a container (id=1)
This Container has 2 pages (id=2 & id=3)
Page 1 has a container (id=2)
Page 2 has a container (id=3)
So now I have to walk up the tree. So if I have the container (id=1) I
need to get the parentpage (id=1), but I only can access the 2
childpages. So is this issue resolvable?