alphagov/whitehall — pull request #1692 by JordanHatch (2014-08-29 14:55:29+00:00)
Title: Unscope SpecialistSector relation to Edition

Each SpecialistSector belongs to an edition. However, if the edition is deleted, requesting the relation returns nil as the default scope for the Edition model is to exclude deleted editions.

By overriding the relation to be unscoped, we can still perform operations on Editions related to SpecialistSectors regardless of their state.

This specific change will make it possible to use the script added in #1688 to remove the `working-sea/fishing` sector tag, which is tagged to several 'deleted' editions.

This is based on prior art in [app/models/classification_membership.rb](https://github.com/alphagov/whitehall/blob/ec83c2ea/app/models/classification_membership.rb#L25).