Wow. It took me ages to find this out but here it is:

I tried running an error validator 'before_destroy' and it would indeed be neater than the current solution. Unfortunately it's not possible because of a very strange reason.

'rootify', or any other strategy except for 'restrict' (ancestry gem), when you remove a node with children, it temporarily removes these children before recreating them. 

If we have a hostgroup hierarchy:

a/b

and you want to delete 'a'.

First, a ```before_save``` will be run on node 'b', with changes ```ancestry => ["a", nil]```
Secondly, ```before_destroy``` will be run on node 'a'. But there are no children, so it destroys it.
You can check this by putting a debugger breakpoint at ```before_save``` and ```before_destroy``` handlers in Hostgroup.

For the moment, there are two options:

- ```rescue_from Ancestry::AncestryException, :with => :error_render_method``` (not sure how to do this, and it sounds error prone)
- Clunky as it is, leaving the code as it is on the PR and rescue Ancestry::AncestryException ourselves wherever they could be an issue.

I don't like any of the possible solutions but I'd lean towards the latter. Your thoughts?