Cleanup loaded features and constants after dependency tests.
Explicit route test class

shows the class that the test must extend in order to have the assert_routing method available
Fix that a collection proxy could be cached before the save of the owner, resulting in an invalid proxy lacking the owner’s id.

Absent this fix calls like: owner.association.update_all to behave unexpectedly because they try to act on association objects where
owner_id is null.

more evidence here: https://gist.github.com/Empact/5865555
```
Active Record 3.2.13
-- create_table(:firms, {:force=>true})
   -> 0.1371s
-- create_table(:clients, {:force=>true})
   -> 0.0005s
1 clients. 1 expected.
1 clients updated. 1 expected.
```

```
Active Record 4.0.0
-- create_table(:firms, {:force=>true})
   -> 0.1606s
-- create_table(:clients, {:force=>true})
   -> 0.0004s
1 clients. 1 expected.
0 clients updated. 1 expected.
```
Allow authentication header to not have to specify 'token=' key.

Fixes: https://github.com/rails/rails/issues/17108.
FileHandler should not be called for files outside the root

FileHandler#matches? should return false for files that are outside the
"root" path.
If Rails is not defined, check ENV["RAILS_ENV"] and ENV["RACK_ENV"].

This fixes a regression introduced by 6cc03675d30b58e28f585720dad14e947a57ff5b.

ActiveRecord, if used without Rails, always checks the "default_env" environment. This would be OK, except that Sinatra also supports environments,
and it runs with {RACK|RAILS}_ENV=production. This patch adds a fallback to RAILS_ENV and RACK_ENV (and ultimately default_env) if Rails.env doesn't exist.
copy reflection_scopes’s unscoped value when building scope for preloading, fixes #11036
Show the user’s application in the source window and select the correct trace list, closes #17312
Raises ArgumentError when try to define a scope without a callable

This changes the actual exception `NoMethodError: undefined method `call'
for #<ActiveRecord::Relation []>` to a `ArgumentError` when try to define
a scope without a callable.
Use type column first in multi-column indexes

`add_reference` can very helpfully add a multi-column index when you use
it to add a polymorphic reference. However, the first column in the
index is the `id` column, which is less than ideal.

The [PostgreSQL docs][1] say:
> A multicolumn B-tree index can be used with query conditions that
> involve any subset of the index's columns, but the index is most
> efficient when there are constraints on the leading (leftmost)
> columns.

The [MySQL docs][2] say:
> MySQL can use multiple-column indexes for queries that test all the
> columns in the index, or queries that test just the first column, the
> first two columns, the first three columns, and so on. If you specify
> the columns in the right order in the index definition, a single
> composite index can speed up several kinds of queries on the same
> table.

In a polymorphic relationship, the type column is much more likely to be
useful as the first column in an index than the id column. That is, I'm
more likely to query on type without an id than I am to query on id
without a type.

[1]: http://www.postgresql.org/docs/9.3/static/indexes-multicolumn.html
[2]: http://dev.mysql.com/doc/refman/5.0/en/multiple-column-indexes.html
[ci skip] Add missing blank line to AR validation.
[ci skip] No need to indent here (AC overview).
[ci skip] Add highlight to code (form helper guide).
Make `String#remove` and `String#remove!` accept multiple arguments
Add back --skip-turbolinks and remove --skip-gems

For the most part of cases --skip-gems option just remove one line in
the Gemfile. This is not worth for the complexity it adds.

Closes #17196
Added queue_name_delimiter attribute.

- Added ActiveJob::Base#queue_name_delimiter to allow for
  developers using ActiveJob to change the delimiter from the default
  ('_') to whatever else they may be using (e.g., '.', '-', ...).

- Updated source guide to include a blurb about the delimiter.
Merge pull request #17362 from bronzle/fix_debug_exceptions_app

Show the user’s application in the source window and select the correct ...
Merge pull request #14143 from derekprior/dp-compound-index-ordering

Use type column first in multi-column indexes

Conflicts:
	activerecord/CHANGELOG.md
Merge pull request #17374 from maurogeorge/scope-exception

Raises ArgumentError when try to define a scope without a callable
Allow Relation#rewhere to work with infinite range values