Upgraded rack
As Rack has some non backwards compatible changes added required
modifications to keep behaviour in rails close to same as before.

Also modified generators to include rack/rack for not yet released
version of rack
Since upgrading rack we can remove unnecessary string encodings
https://github.com/rack/rack/commit/5a5aee36
Remove PG's definition of `type_cast`

All cases except for `nil` in an array have been removed. `nil` in an
array is handled by the Array type object.
Don't rely on the sql type to quote XML columns in PG
Remove the `text?` predicate from the type objects

This was only used for uniqueness validations. The first usage was in
conjunction with `limit`. Types which cast to string, but are not
considered text cannot have a limit. The second case was only with an
explicit `:case_sensitive => true` option given by the user.
Avoid retrieving connection in ActiveRecord::QueryCache multiple times.
Update Rails versions [ci skip]

As discussed in #15304, we need to automate this process but for now,
having out-of-date versions is not ideal.

Since master targets 4.2.0, let's also update references to the last 4.1
version to 4.2.0.

Finally, let's remove mentions to versions when this is not needed. The
guides cover the features of the current version anyway.

[Juanito Fatas + Robin Dupret]
Merge pull request #16086 from nickpellant/master

Add callbacks documentation for upgrading to 4.1.
Merge pull request #16074 from sgrif/sg-remove-text-predicate

Remove the `text?` predicate from the type objects
Merge pull request #16078 from tgxworld/retreive_connection_once

Avoid retrieving connection in ActiveRecord::QueryCache multiple times.
always test against a routed rack app so there are always url_helpers
remove the mounted_helpers respond_to check

It always responds to mounted_helpers now
test i18n against a routed app
Reduce number of subscriptions created.
Merge pull request #16072 from sgrif/sg-xml-quoting

Don't rely on the sql type to quote XML columns in PG
Merge pull request #16071 from sgrif/sg-pg-type-cast

Remove PG's definition of `type_cast`
Warm up cache to prevent assertion failure.
Merge pull request #16093 from zuhao/refactor_activerecord_nested_through_associations_test

Warm up cache to prevent assertion failure.
Include fixtures to prevent foreign key violation.
Merge pull request #16094 from zuhao/refactor_activerecord_belongs_to_associations_test

Include fixtures to prevent foreign key violation.