def find_or_create_by_path(path, attributes = {})
      subpath = _ct.build_ancestry_attr_path(path, attributes)
      return self if subpath.empty?

      found = find_by_path(subpath, attributes)
      return found if found

      attrs = subpath.shift
      _ct.with_advisory_lock do
        # shenanigans because children.create is bound to the superclass
        # (in the case of polymorphism):
        child = self.children.where(attrs).first || begin
          # Support STI creation by using base_class:
          _ct.create(self.class, attrs).tap do |ea|
            # We know that there isn't a cycle, because we just created it, and
            # cycle detection is expensive when the node is deep.
            ea._ct_skip_cycle_detection!
            self.children << ea
          end
        end
        child.find_or_create_by_path(subpath, attributes)
      end
    end
def find_or_create_by_path(path, attributes = {})
      subpath = _ct.build_ancestry_attr_path(path, attributes)
      return self if subpath.empty?

      found = find_by_path(subpath, attributes)
      return found if found

      attrs = subpath.shift
      _ct.with_advisory_lock do
        # shenanigans because children.create is bound to the superclass
        # (in the case of polymorphism):
        child = self.children.where(attrs).first || begin
          # Support STI creation by using base_class:
          _ct.create(self.class, attrs).tap do |ea|
            # We know that there isn't a cycle, because we just created it, and
            # cycle detection is expensive when the node is deep.
            ea._ct_skip_cycle_detection!
            self.children << ea
          end
        end
        child.find_or_create_by_path(subpath, attributes)
      end
    end
Find or create a descendant node whose +ancestry_path+ will be ```self.ancestry_path + path```