not sure i follow what this is doing? all hostgroups used by another policy? if thats true you can do:
```ruby
Scaptimony::PolicyHostgroup.where(['hostgroup_id is not ?', id]).uniq
```