Prevent state leak.
Remove redundant code.
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.
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.
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
Further simplify `changed?` conditional for numeric types

`Type::Integer.new.type_cast('') # => nil`, we do not need a special
case to handle this, `nil => ''` already returns false. The only case we
need to handle is `0 => 'wibble'` should be changed, while `0 => '0'`
should not.
Add to guides app and helper objects on command line

[ci skip]
Merge pull request #15814 from sgrif/sg-number-changed

Further simplify `changed?` conditional for numeric types
Merge pull request #15803 from sgrif/sg-column-in-associations

Don't rely on the column for type casting reflections
Merge pull request #15802 from sgrif/sg-column-quoting

Don't use column object for type casting in `quoting`
Merge pull request #15801 from sgrif/sg-column-defaults

Don't use column object when calculating type cast defaults
Merge pull request #15800 from sgrif/sg-column-in-calculation

Don't use `Column` for type casting in Relation calculations
ErrorsController shouldn't inherit ApplicationController, but ActionController::Base

Inheriting `ApplicationController` often causes an issue as it always
has before/after actions. It should encourage to use `ActionController::Base` instead.

[ci skip]
Merge pull request #15747 from sgrif/sg-trolololol-this-is-so-broken

Always update counter caches in memory when adding records
Merge pull request #15823 from yuki24/better-docmentation-for-dynamic-error-pages

ErrorsController shouldn't inherit ApplicationController, but ActionController
Merge pull request #15728 from sgrif/sg-double-save-hm-t

Don't save through records twice

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/associations/has_many_through_associations_test.rb
add both branches to the only_path conditional