AncestorOrSelf() returns self - should be Breaking Change - upgrading v6 to v7
Hello,
I've bumped into a small issue while upgrading from v6 to v7 - AncestorOrSelf() (no parameters) now returns the node itself and not the root node as it was before - this breaks all my templates as I have been using AncestorOrSelf() as main method to get root node.
To be version specific - I am updating from v6.1.3 to v6.2.1 then to v7.1.4 . I didn't find any related breaking change in versions specific lists from 6.1.3 to 7.1.4. Maybe i am missing something, but if not - it definitely should be there.
When browsing Umbraco source, I found that this change was introduced in v6.2.0:
// note: that one makes no sense and should return self -- but fixing that
// would be a breaking change. Defining FIX_AXES would fix the situation.
AncestorOrSelf() returns self - should be Breaking Change - upgrading v6 to v7
Hello,
I've bumped into a small issue while upgrading from v6 to v7 - AncestorOrSelf() (no parameters) now returns the node itself and not the root node as it was before - this breaks all my templates as I have been using AncestorOrSelf() as main method to get root node.
To be version specific - I am updating from v6.1.3 to v6.2.1 then to v7.1.4 . I didn't find any related breaking change in versions specific lists from 6.1.3 to 7.1.4. Maybe i am missing something, but if not - it definitely should be there.
When browsing Umbraco source, I found that this change was introduced in v6.2.0:
As comment states, "#if FIX_AXES" should fix that. Maybe it fixes for v6 (haven't tested), but not for v7.1.4.
This code is still the same in 7.1.4 so I don't know what happened. We don't compile with FIX_AXES turned on so that's not it.
I have also made a fresh install of v7.1.4 downloaded from http://our.umbraco.org/contribute/releases/714 - AncestorOrSelf() also returns self, so it is not a problem with upgrade.
What does your content tree look like and on which page in that content tree are you calling AncestorOrSelf() ?
Tested it on TXT starter kit in news page:
@CurrentPage.AncestorOrSelf().Name outputs "Test page"
Hi Pavel,
Can you provide an example of how you're using the method?
Kind regards, Bilal
Hi Bilal,
I get current site root node in my templates like this:
Now I need to use Model.Content.AncestorOrSelf(1)
is working on a reply...