module Ancestry::MaterializedPath2::InstanceMethods
Public Instance Methods
child_ancestry()
click to toggle source
# File lib/ancestry/materialized_path2.rb, line 42 def child_ancestry # New records cannot have children raise Ancestry::AncestryException.new(I18n.t("ancestry.no_child_for_new_record")) if new_record? "#{attribute_in_database(self.ancestry_base_class.ancestry_column)}#{id}#{self.ancestry_base_class.ancestry_delimiter}" end
child_ancestry_before_save()
click to toggle source
# File lib/ancestry/materialized_path2.rb, line 48 def child_ancestry_before_save # New records cannot have children raise Ancestry::AncestryException.new(I18n.t("ancestry.no_child_for_new_record")) if new_record? "#{attribute_before_last_save(self.ancestry_base_class.ancestry_column)}#{id}#{self.ancestry_base_class.ancestry_delimiter}" end
generate_ancestry(ancestor_ids)
click to toggle source
# File lib/ancestry/materialized_path2.rb, line 54 def generate_ancestry(ancestor_ids) if ancestor_ids.present? && ancestor_ids.any? "#{self.ancestry_base_class.ancestry_delimiter}#{ancestor_ids.join(self.ancestry_base_class.ancestry_delimiter)}#{self.ancestry_base_class.ancestry_delimiter}" else self.ancestry_base_class.ancestry_root end end