Update routes for Rails 4 compatibility

- The `match` method is no longer supported.
- Rails 4 does not like there to be more than one root route specified
  unless they are explicitly named.
Scopes (including defaults) must be lambdas
No need to require rubygems on boot
Move parameter filtering to initializer

This is what Rails 4 does by default
Fix multiline validation regexes

Rails 4 emits warnings when you use ^$ (start/end of line) instead of
\A\Z (start/end of string), unless you explicitly set the :multiline
option to true.
Replace calls to #with_exclusive_scope

Rails 4 deprecates this method
No need for assert_block here
Access AR#attributes using strings

In Rails 4 #attributes returns a regular hash rather with string keys
rather than a HashWithIndifferentAccess.
Ensure ordering is as outlined in test

This is required to override the default ordering that exists
on the DocumentCollection#editions association that the editions are
accessed through.
Worldwide orgs factory generates unique names
Handle different behaviour of AR and factory_girl

We cannot rely on the ordering to be correctly set when passing in an
array of attachments to the factory method
Remove #readonly override from join models

Rails 4 changes the behaviour of ActiveRecord such that a model that
is marked as "readonly" can no longer be destroyed (see
https://github.com/iGEL/rails/commit/a8b370f5c2fed87001e363d18ce60a47c1748885).
This prevents EditionRelations and ClassificationRelations from being
destroyed. Looking back through the git history, it looks like this
was originally put in as a way to prevent these join models from being
modified once they were created. I can't think of any good reason why
we should be enforcing this at the model level so I'm simply removing
the readonly designation from the model.
Don't rely on transient behaviour of factories/AR

Instead, the test should replicate the way that groups are created on
collections in real-world app usage.
No more need for distinct option on count
Merge pull request #1200 from alphagov/rails-4-compatibility-fixes

Rails 4 compatibility fixes
A raft of changes that fix compatibility with Rails 4, mostly due to deprecations.