alphagov/whitehall — pull request #7 by lazyatom (2012-06-12 16:35:49+00:00)
Title: `Role#to_s` shouldn't know anything about the current person.

Using a default `to_s` method from `Role` everywhere that a minister was used was, I believe, muddying the distinction between Role, RoleAppointment and Person, and made it harder to sensibly construct strings and links to each which included just the right amount of context to be useful.

I have extracted the `current_person` usage out of the Role (except for the search_index, although perhaps that's a pointer that we should really be indexing appointments, or people, or some other combination of information?).

I've made this a pull request partly to get a second pair of eyes on it, and partly because it touches quite a few files.

I know that I've introduced some duplication in this commit, but I feel that it's better to have HTML that's constructed independently than be constrained by a string generated in the model. Perhaps there is a sensible helper that can be extracted.