module Ancestry::MaterializedPath::InstanceMethods

Public Instance Methods

sane_ancestry?() click to toggle source

Validates the ancestry, but can also be applied if validation is bypassed to determine if children should be affected

# File lib/ancestry/materialized_path.rb, line 67
def sane_ancestry?
  ancestry_value = read_attribute(self.ancestry_base_class.ancestry_column)
  ancestry_value.nil? || (ancestry_value.to_s =~ Ancestry::ANCESTRY_PATTERN && !ancestor_ids.include?(self.id))
end