diff --git a/lib/ancestry/materialized_path.rb b/lib/ancestry/materialized_path.rb index a2fff5a6..c537a4e2 100644 --- a/lib/ancestry/materialized_path.rb +++ b/lib/ancestry/materialized_path.rb @@ -86,7 +86,7 @@ module InstanceMethods # Validates the ancestry, but can also be applied if validation is bypassed to determine if children should be affected def sane_ancestry? ancestry_value = read_attribute(self.ancestry_base_class.ancestry_column) - (ancestry_value.nil? || !ancestor_ids.include?(self.id)) && valid? + ancestry_value.nil? || (!ancestor_ids.include?(self.id) && (valid? || errors[self.ancestry_base_class.ancestry_column].blank?)) end # optimization - better to go directly to column and avoid parsing