The thing is, this isn't technically incorrect. It's just not how we group categories.

A category don't usually have a parent_id. They are grouped under the category_groups through HABTM. Not through the parent_id.

In fact, if you group categories under category_groups with parent_id, that eliminates quite a bit of the flexibility in banyan. Since then a category cannot belong to multiple category_groups.

So if you want to verify that a category is unique inside a category_groups you should verify the uniqueness inside the HABT join table.

I think writing your own custom validator is the way to go.