Prevent state leak.
Remove redundant code.
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.
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 include inheritance column in the through_scope_attributes
Titling the model name in views generated by scaffold.
eg. rails g scaffold UserProfile will have in index.html.erb "Listing User Profiles"
rather than Listing user_profiles.
Extract out with_env_tz helper method.

It’s used at so many places that extracting it out into a helper file
is worth doing.
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
Merge pull request #15799 from zuhao/refactor_activesupport_time_zone_test_helpers

Extract out with_env_tz helper method.
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
Merge pull request #15795 from amitsuryavanshi/master

Titling the model name in views generated by scaffold.
Create custom errors page on ActionController guides

[ci skip]
this method is no longer being used
Remove unused block parameter from #gsub call in AM::MailHelper#block_format
Merge pull request #15812 from crankharder/remove_postgres_adapter_method

remove unused method from Postgresql::Adapter
Relpace `=~ Regexp.new str` with `.include? str` in AC::Base#_valid_action_name?

Because it is more natural way to test substring inclusion. Also, in
this particular case it is much faster.

In general, using `Regexp.new str` for such kind of things is dangerous.
The string must be escaped, unless you know what you're doing. Example:

    Regexp.new "\\" # HELLO WINDOWS
    # RegexpError: too short escape sequence: /\/

The right way to do this is escape the string

    Regexp.new Regexp.escape "\\"
    # => /\\/

Here is the benchmark showing how faster `include?` call is.

```
require 'benchmark/ips'

Benchmark.ips do |x|
  x.report('include?') { !"index".to_s.include? File::SEPARATOR }
  x.report('   !~   ') { "index" !~ Regexp.new(File::SEPARATOR) }
end

__END__
Calculating -------------------------------------
            include?     75754 i/100ms
               !~        21089 i/100ms
-------------------------------------------------
            include?  3172882.3 (±4.5%) i/s -   15832586 in   5.000659s
               !~      322918.8 (±8.6%) i/s -    1602764 in   4.999509s
```

Extra `.to_s` call is needed to handle the case when `action_name` is
`nil`. If it is omitted, some tests fail.
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.