Only raise DelegationError if it's is the source of the exception

This fixes situations where nested NoMethodError exceptions are masked
by delegations. This would cause confusion especially where there was a
problem in the Rails booting process because of a delegation in the
routes reloading code.

Fixes #10559
(cherry picked from commit 07a4c76a07641840892463eb934400abdf694927)

Conflicts:
	activesupport/CHANGELOG.md
No need to add config for x_sendfile_header

Rack::Sendfile is loaded by default now
Merge pull request #10417 from jholton/fix_association_auto_save

autosave_association issue that occurs when table has unique index (resubmission)
Conflicts:

	activerecord/CHANGELOG.md
Merge pull request #11451 from jetthoughts/11450_do_not_resave_destroyed_association

Do not re-save destroyed association on saving parent object
`change_column` for PG adapter respects `:array` option.

Conflicts:

	activerecord/CHANGELOG.md
Merge pull request #11120 from awilliams/ar_mysql2_boolean_quoting

Fixes AR mysql2 adapter incorrectly casting boolean values
Conflicts:

	activerecord/CHANGELOG.md
Skip Rack applications and redirects when generating urls

When generating an unnamed url (i.e. using `url_for` with an options
hash) we should skip anything other than standard Rails routes otherwise
it will match the first mounted application or redirect and generate a
url with query parameters rather than raising an error if the options
hash doesn't match any defined routes.

Fixes #8018
(cherry picked from commit 1555a1800ea550a991eb57ce1ec8236bdba0365a)

Conflicts:
	actionpack/CHANGELOG.md
Revert "Merge pull request #11120 from awilliams/ar_mysql2_boolean_quoting"

This reverts commit 5ac6fac1ad108e7f2a508da8b2fc090d43b2435f.
Running isolated tests

These stopped running don't know when.
But these should be running now.(cherry picked from commit 5eaa30e47c91716006b755b7c211d82bf81f7fc1)
Added routing in test for actionpack
(cherry picked from commit 96310f69e1fd4bf0d744ed9599df895ef1fcf2d1)

Conflicts:
	actionpack/Rakefile
Fix failing test missed for the past year :(

When optimized path helpers were re-introduced in d7014bc the test added
in a328f2f broke but no-one noticed because it wasn't being run by the
test suite.

Fix the test by checking for nil values or empty strings after the args
have been parameterized.
(cherry picked from commit 74722d66d332d1d768459d8b510cc082fe3d5618)