Merge pull request #15795 from amitsuryavanshi/master

Titling the model name in views generated by scaffold.
Added missing colon in asset manifest JSON.
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.
Add `logger.debug?` guard to `ActionMailer::LogSubscriber#process`

*TLDR*: The method is 4 times faster when log level is higher than DEBUG.
Also, the other two methods, `#deliver` and `#receive` have similar guard statements,
so this commit adds some symmetry to the code.

This is probably not the most critical part of ActionMailer in terms
of performance, but here are some benchmarks:

```
require 'benchmark/ips'
require 'action_mailer'

event = ActiveSupport::Notifications::Event.new(
            'process.action_mailer',
            Time.now,
            Time.now,
            'bf4e2b36ce085fd35b24',
            { mailer: "UserMailer", action: :welcome }
        )

ActionMailer::Base.logger = ActiveSupport::Logger.new '/dev/null'

subscriber = ActionMailer::LogSubscriber.new
def subscriber.process_with_guard(event)
  return unless logger.debug?
  mailer = event.payload[:mailer]
  action = event.payload[:action]
  debug("\n#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms")
end

Benchmark.ips do |r|
  ActionMailer::Base.logger.level = ::Logger::Severity::INFO
  r.report('no guard') { subscriber.process(event) }
  r.report('   guard') { subscriber.process_with_guard(event) }
end

__END__
Calculating -------------------------------------
            no guard      9640 i/100ms
               guard     38381 i/100ms
-------------------------------------------------
            no guard   169166.9 (±10.2%) i/s -     838680 in   5.007262s
               guard   728184.9 (±9.6%) i/s -    3607814 in   4.999218s
```

When log level is DEBUG, the _guarded_ method is a bit slower. This is a
good tradeoff for 4x improvement in production mode.

```
Benchmark.ips do |r|
  ActionMailer::Base.logger.level = ::Logger::Severity::DEBUG
  r.report('no guard') { subscriber.process(event) }
  r.report('   guard') { subscriber.process_with_guard(event) }
end

__END__
Calculating -------------------------------------
            no guard      4970 i/100ms
               guard      4564 i/100ms
-------------------------------------------------
            no guard    55617.4 (±3.5%) i/s -     278320 in   5.010523s
               guard    49452.1 (±5.6%) i/s -     251020 in   5.093358s

```
Merge pull request #15816 from DNNX/log-subscriber-add-debug-check

Add `logger.debug?` guard to `ActionMailer::LogSubscriber#process`
Merge pull request #15815 from DNNX/mail-helper-refactoring

Remove unused block parameter from #gsub call in AM::MailHelper#block_format
Merge pull request #15813 from DNNX/valid-action-name-refactoring

Relpace `=~ Regexp.new str` with `.include? str` in `_valid_action_name?`
[ci skip] Fix typo in 4.1 upgrade/flash structure
Merge pull request #15817 from zoombody/patch-1

Fix typo in 4.1 upgrade/flash structure
excerpt() now accepts regular expression instances as phrases.
highlight() now accepts regular expressions as well.
Fix has_and_belongs_to_many in a namespaced model pointing to a non namespaced model

Now the following case will work fine

    class Tag < ActiveRecord::Base
    end

    class Publisher::Article < ActiveRecord::Base
      has_and_belongs_to_many :tags
    end

Fixes #15761
Use a better test description
Merge pull request #15772 from nbudin/sti_through_bug

Don't include inheritance column in the through_scope_attributes
'TextHelper#highlight' now accepts a block to highlight the matched words.

The helper will yield each matched word, and you can use this instead of the
':highlighter' option for more complex replacing logic:

  highlight('My email is me@work.com', EMAIL_REGEXP) { |m| mail_to(m) }
  # => 'My email is <a href="mailto:me@work.com">me@work.com</a>'