When I run this code:
Category.where(name: child_name).update_all parent_id: parent.id
the category_hierarchies
-table is not populated correctly. Thus queries like category.ancestors.pluck(&:name)
are always empty even though category.parent_id
is right.