Fix an issue where router can't recognize downcased url encoding path.
Merge pull request #12276 from kennyj/fix_12269

Fix an issue where router can't recognize downcased url encoding path.
do what the superclass does in the case that objects do not match
ActiveRecord::Base#<=> has been removed.  Primary keys may not be in order,
or even be numbers, so sorting by id doesn't make sense.  Please use `sort_by`
and specify the attribute you wish to sort with.  For example, change:

  Post.all.to_a.sort

to:

  Post.all.to_a.sort_by(&:id)
support objects with blank string primary keys
remove unused variable
NullSessionHash#destroy should be a no-op

Previously it was raising a NilException
Merge pull request #12279 from jbaudanza/reset_session

Calling reset_session inside of a controller with a NullSessionHash raises a nil exception.
Remove 1.8 compatible code
Merge pull request #12280 from kennyj/remove_1_8_compat

Remove 1.8 compatible code
Fix incorrect assert_redirected_to failure message

In some instances, `assert_redirected_to` assertion was returning an
incorrect and misleading failure message when the assertion failed.
This was due to a disconnect in how the assertion computes the redirect
string for the failure message and how `redirect_to` computes the
string that is actually used for redirection.

I made the `_compute_redirect_to_loaction` method used by `redirect_to`
public and call that from the method `assert_redirect_to` uses to
calculate the URL.

The reveals a new test failure due to the regex used by
`_compute_redirect_to_location` allow `_` in the URL scheme.
Fix regex used to find URI schemes in redirect_to

The previous regex was allowing `_` in the URI scheme, which is not
allowed by RFC 3986. This change brings the regex in line with the RFC.
Merge pull request #10362 from derekprior/dp-fix-assert-redirect-to

Fix incorrect assert_redirected_to failure message
Add `#any_of` query method to active_record

This method is inspired by [any_of from
mongoid](http://two.mongoid.org/docs/querying/criteria.html#any_of).

It is hooked on `WhereChain`, just like `#not`, and allows to compute an
`OR` like query that leverages AR's `#where` syntax:

    manual_removal = User.where(id: params[:users][:destroy_ids])
    users = User.where.any_of(manual_removal, "email like '%@example.com'", {banned: true}).destroy_all

It can be used anywhere `#where` is expected to work :

    manual_removal = User.where(id: params[:users][:destroy_ids])
    User.where.any_of(manual_removal, "email like '%@example.com'", {banned: true})
    @company.users.where.any_of(manual_removal, "email like '%@example.com'", {banned: true})
    User.where(offline: false).where.any_of( manual_removal, "email like '%@example.com'", {banned: true})

Its main purpose is to both :

* remove the need to write a sql string when we want an `OR`
* allow to write dynamic `OR` queries, which would be a pain with a string

There's also a negative version, `#none_of`. This will return all active
users :

    banned_users = User.where(banned: true)
    unconfirmed_users = User.where("confirmed_at IS NULL")
    active_users = User.where.none_of(banned_users, unconfirmed_users)