alphagov/whitehall — pull request #212 by h-lame (2013-02-14 10:32:28+00:00)
Title: New edition organisations interface

Replace the overly complex edition_organisations API and validations with something less complex. It's still not standard association and validation, but it is simpler than it was and makes it less likely we'll hit up against ActiveRecord weirdness with associations and duplicate-key errors. It used to be 3 associations and a lot of code to try and work out if an edition organisation was being edited via any 3 of them, now it's one association with some extra setter methods for convenience.

Specifically, this should get rid of all the duplicate-key errors we get when people try to swap the order of their lead orgs, or move a lead org over to be supporting and then shuffle the other lead orgs up the tree.