alphagov/whitehall — pull request #551 by h-lame (2013-05-14 11:15:02+00:00)
Title: Searchable take part pages

For: https://www.pivotaltracker.com/story/show/49246657

Make Take Part Pages into searchable things and have a data migration to add all the existing ones to the index. That's the first 4 commits.

The rest is work to remove all the times we do ``include Rails.application.routes.url_helpers`` (and other route helper inclusion) and instead to use an object that does url generation. It's based on the routes_helper method used in some data migrations, but extended somewhat and made more generally available.

We now have ``Whitehall.url_maker`` to generate paths (you can do urls if you supply the ``host`` param manually). Or you can build a ``Whitehall::UrlMaker`` yourself and supply default options to the initializer to avoid having to pass ``host`` all the time (e.g. ``Whitehall::UrlMaker.new(host: 'www.yahoo.com', protocol: 'ftp')`` to make all urls belong to ``ftp://www.yahoo.com``.

Ideally I'd have broken this up into 2 pull requests, but the work for the latter was "inspired" by the work on the former (where I had to pull in the url_helpers to ``TakePartPage``) and I'd rather not have PRs that rely on each other.

As well as updating models I've tidied up various data migrations and scripts to use a UrlMaker instead. Would really appreciate the reviewer taking a good look at them as I'm not sure they have test coverage.