app/models/group.rb
# Deletes current group and all of it's subtree
# If you delete New York subtree expect every child, grandchild and so on to be deleted too
Deletes current group and all of it's subtree
If you delete New York subtree expect every child, grandchild and so on to be deleted too
Deletes current group and all of it ' s subtree If you delete New York subtree expect every child grandchild and so on to be deleted too
def delete_subtree
    children.each do |child|
      child.delete_subtree
    end
    User.where(group_id:id).each do |u|
      u.update_attribute(:group_id, nil)
    end
    manager_group_permission.each do |m|
      m.delete
    end
    delete
  end
def delete_subtree children . each do | child | child . delete_subtree end User . where ( group_id : id ) . each do | u | u . update_attribute ( :group_id , nil ) end manager_group_permission . each do | m | m . delete end delete end
Deletes current group and all of it's subtree
If you delete New York subtree expect every child, grandchild and so on to be deleted too
Deletes current group and all of it ' s subtree If you delete New York subtree expect every child grandchild and so on to be deleted too