Module: Ancestry::MaterializedPath2::InstanceMethods

Defined in:
lib/ancestry/materialized_path2.rb

Instance Method Summary collapse

Instance Method Details

#child_ancestryObject

Please see notes for MaterializedPath#child_ancestry



68
69
70
71
72
# File 'lib/ancestry/materialized_path2.rb', line 68

def child_ancestry
  raise(Ancestry::AncestryException, I18n.t("ancestry.no_child_for_new_record")) if new_record?

  "#{attribute_in_database(self.class.ancestry_column)}#{id}#{self.class.ancestry_delimiter}"
end

#child_ancestry_before_last_saveObject

Please see notes for MaterializedPath#child_ancestry_before_last_save



75
76
77
78
79
80
81
# File 'lib/ancestry/materialized_path2.rb', line 75

def child_ancestry_before_last_save
  if new_record? || (respond_to?(:previously_new_record?) && previously_new_record?)
    raise(Ancestry::AncestryException, I18n.t("ancestry.no_child_for_new_record"))
  end

  "#{attribute_before_last_save(self.class.ancestry_column)}#{id}#{self.class.ancestry_delimiter}"
end