0

I have a Site Model that has_ancestry. This model hierarchy has two trees....

TREE1

SiteA (Root)

  • SiteB
  • SiteC

TREE2

SiteC (Root)

  • SiteD

Is there a method or SQL statement to show the link between SiteA and SiteD?

Or is this not possible given they exist on separate trees (associated via SiteC)?

  • I don't know ancestry per say, but you can try and have a look at this question, which describes your situation in a different frame. https://stackoverflow.com/questions/14518090/recursive-query-in-sql-server – ekampp Aug 14 '18 at 20:42

1 Answers1

0

You can check with the while loop to go down to upwards and check until parent is nil.

Ruby4Rails
  • 81
  • 1
  • 11