alphagov/whitehall — pull request #730 by gma (2013-08-05 13:10:04+00:00)
Title: Associate (some) editions directly with topics

Previous behaviour: editions that inherit from Announcement and Publicationesque could only be associated with a Topic via the policies that they'd been associated with.

The story was to allow editions to be appear on /government/publications and /government/announcements (when those pages are filtering editions by topic), even if they weren't assigned to any policies. The solution; to copy the associations from editions' policies' topics directly onto the editions themselves.

The code knows how to find a topics' editions either via the policy relationship, or via the direct relationship with editions (and vice versa). We don't need that complexity long term, but we want the site to keep working before we get the new edition-to-topics relationships in place in the database.

The plan for deployment:

1. Deploy the code.
2. Run the `topics:from_policies_to_editions` rake task.
3. Revert commit 9c4c5c5 (should it get rebased, the message begins "Find topic's documents…")
4. Redeploy the code.

(there may be a few tests to fix inbetween steps 3 and 4; I'm envisaging it being a separate [short] story in the next sprint)

Story: https://www.pivotaltracker.com/story/show/51263883