Prototype a basic departmental leaderboard

- This is so that users of the transition tool can see who has the most
  mappings, the most unresolved mappings and the most errors.
- These queries are messy raw SQL and the page times out on first load.
Use SQL's INNER JOIN instead of listing multiple tables in the FROM

- Thanks to Russell for the tutorial. :-)
Use number_with_delimiter to pretty-print the numbers
Consolidate leaderboard into mahoosive query

* Bunch of joined subqueries
* About 1/2s. Still not great but doesn't time out
* Really tiny amount of Rails integration
* leaderboard/index.html.erb loses some looping
Add a link to the organisation's page from each row of the leaderboard
Order the table by error count with biggest offenders first

- Add a down arrow to the errors column header so that users know what
  the data is being filtered on.
Add a title and a description to the leaderboard page

- This needs some copy work, probably.
Add a Cucumber feature to check that the leaderboard page displays

- Only for GDS Editors at the moment - do we want to open this up to
  everyone?
Use a Bootstrap-styled down arrow instead of the HTML entity
Only count errors occurring in the last thirty days

- Do this in SQL, no client-side config for the user to choose their
  date range.
Get rid of a deprecation warning on the leaderboard scope, since Rails 4
Add a comment to the huge leaderboard scope, and some RSpec tests for it

- Paired with Jamie on this.
Decrease the number of INSERT queries with `testing_before_all: true`
Merge pull request #357 from alphagov/spike_prototype_department_leaderboard

Departmental leaderboard
Add Rails 4 binstubs to project

* This allows us to execute rake, cucumber and other registered binaries in
  the context of the bundle without the need for `bundle exec`
* To add new ones,
	`bundle binstubs some-gem-name`
  	`git add bin/new-executable`
Move stray concern for nilifying blanks

* Was in lib, can now live in Concerns::NilifyBlanks
Remove redundant (post-rails 4) backports

Conflicts:
	config/initializers/active_record_extensions.rb
Connect to the database via localhost in dev and test

Doing this for postgres means that we don't need to add any pg_hba.conf
rules in dev for the app to be able to authenticate as the transition
role, because one of the default rules already allows it. Using host
authentication for postgres will also make dev more similar to production.

This works for mysql in dev too, so we might as well do this on master
to minimise the diff for postgres branches.

This file is overwritten on deployment so this change makes no difference
for production.
Remove PaperTrail patch

* covered pre-rails4 deprecation warning
Make tests quieter

* Transition::Import was quite noisy, printing as it did to $stderr a lot
* Add a global #active= to allow printing of messages to null console
* Remove unused option to print anywhere else but $stderr
* Add #console_puts and #console_prints to route these messages through
* extend class-method using import classes to use these. Don't use
  any raw puts/print