Make related_policy_ids method more robust

Two things this method was doing wrong:

  * It was returning non-policies
  * It fell over if the related document had been deleted

This was causing issues when trying to edit an edition that was related to "deleted" documents.

Story: https://www.agileplannerapp.com/boards/173808/cards/6176