class Object

Public Instance Methods

sibling_count() click to toggle source
# File lib/ancestry_direct_children.rb, line 5
def sibling_count
  return (self.parent.direct_children_count - 1)
end
update_parent_children_count() click to toggle source
# File lib/ancestry_direct_children.rb, line 16
def update_parent_children_count
  unless self.parent.nil?
    self.parent.update_column(:direct_children_count, self.parent.child_ids.count)
  end
end
update_parent_children_count!() click to toggle source
# File lib/ancestry_direct_children.rb, line 9
def update_parent_children_count!
  unless self.parent.nil?
    self.parent.direct_children_count = self.parent.child_ids.count
    self.parent.save!
  end
end