Fix bug, when ':dependent => :destroy' option violates foreign key constraints, issue #12380
Use NameError#name to assert raised error.

This makes the test compatible with other Ruby implementations, which
may implement error messages differently.
Moved explanation of `--mountable` option up

The example code uses `--mountable`. In previous version this was followed by an explanation of the `--full` option, which doesn't make sense. Later on in the text this is better explained. I moved this explanation up without repeating too much.
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
Prevent state leak.
Remove redundant code.
If a counter_cache exists, use it for #empty?
Fixed a regression introduced in 84cf156

84cf156 (PR #15694) introduced a subtle regression. There are actually three
distinct entry points to creating an AR object – via .new (i.e. #initialize),
via #init_with (e.g. from YAML or database queries) and via .allocate.

With the patch in 84cf156, attribute methods and respond_to? will not work
correctly when objects are allocated directly, without going through either

The reason this test case didn't catch the regression was that the `Topic`
class is shared between test cases, so by the time this test case is ran the
attribute methods are very likely to be defined.

Switching to use a fresh anonymous class in the test to ensure we surface this
problem in the future.
remove unnecessary substitution for space in ActionView::Helpers#debug
Always update counter caches in memory when adding records

Before, calling `size` would only work if it skipped the cache, and
would return a different result from the cache, but only if:

- The association was previously loaded
- Or you called size previously
- But only if the size was 0 when you called it

This ensures that the counter is appropriately updated in memory.
[ci skip] correct output for asset_helper methods
    see cc255d3
Formatting fix in AS changelog [ci skip]
Revert "Formatting fix in AS changelog [ci skip]"

This reverts commit cede0363830e28e73feafc662eccae7d1db526bb.

Reason: CHANGELOG should not be updated on docrails
Don't save through records twice

If the through record gets created in an `after_create` hook that is
defined before the association is defined (therefore after its
`after_create` hook) get saved twice. This ensures that the through
records are created only once, regardless of the order of the hooks.
Detect in-place modifications on Strings
Don't use `Column` for type casting in Relation calculations
Don't use column object when calculating type cast defaults

Moves towards removing type casting knowledge from the column entirely
Don't use column object for type casting in `quoting`

We're never going to be able to use the attribute object here, however,
so let's just accept the ugly demeter violation here for now.

Remove test cases which were either redundant with other tests in the
file, or were actually testing the type objects (which are tested
elsewhere)
Don't rely on the column for type casting reflections