Merge pull request #17797 from y-yagi/donot_delete_mailer_layouts

Don't remove mailer layouts files
Correctly handle multiple attribute method prefix/suffixes which match

Active Record defines `attribute_method_suffix :?`. That suffix will
match any predicate method when the lookup occurs in Active Model. This
will make it incorrectly decide that `id_changed?` should not exist,
because it attempts to determine if the attribute `id_changed` is
present, rather than `id` with the `_changed?` suffix. Instead, we will
look for any correct match.

Fixes #17900
Merge pull request #17817 from aripollak/hide-activejob-args

GlobalID objects are logged by their URI, not #inspect on the object, to prevent logging private data
Include missing require
Correctly respect subtypes for PG arrays and ranges

The type registration was simply looking for the OID, and eagerly
fetching/constructing the sub type when it was registered. However,
numeric types have additional parameters which are extracted from the
actual SQL string of the type during lookup, and can have their behavior
change based on the result.

We simply need to use the block form of registration, and look up the
subtype lazily instead.

Fixes #17935
Preparing for 4.2.0.rc2 release
Merge pull request #17944 from tjschuck/mounted_named_routes_regression

Mounted Rack apps should have default named routes based on app name
Merge pull request #17964 from carols10cents/improve-after-commit-argumenterror-message

Make error message clearer that :on requires a symbol, not a string
Only check that it is a Rails application once

Also avoid using try since is_a? is faster for this case.
Revert to 4.1 behavior for casting PG arrays

The user is able to pass PG string literals in 4.1, and have it
converted to an array. This is also possible in 4.2, but it would remain
in string form until saving and reloading, which breaks our
`attr = save.reload.attr` contract. I think we should deprecate this in
5.0, and only allow array input from user sources. However, this
currently constitutes a breaking change to public API that did not go
through a deprecation cycle.
Don't error when `attributes` is called on a frozen AR model

`freeze` will ultimately end up freezing the `AttributeSet`, which in
turn freezes its `@attributes` hash. However, we actually insert a
special object to lazily instantiate the values of the hash on demand.
When it does need to actually instantiate all of them for iteration (the
only case is `ActiveRecord::Base#attributes`, which calls
`AttributeSet#to_h`), it will set an instance variable as a performance
optimization

Since it's just an optimization for subsequent calls, and that method
being called at all is a very uncommon case, we can just leave the ivar
alone if we're frozen, as opposed to coming up with some overly
complicated mechanism for freezing which allows us to continue to modify
ourselves.

Fixes #17960
Allow custom handling of non-standard types in `time_zone_conversion`

PostgreSQL for example, allows infinity as a valid value for date time
columns. The PG type has explicit handling for that case. However, time
zone conversion will end up trampling that handling. Unfortunately, we
can't call super and then convert time zones.

However, if we get back nil from `.in_time_zone`, it's something we
didn't expect so we can let the superclass handle it.

Fixes #17971
Update test case for TZ aware attributes

The test added in 42418cfc94d1356d35d28d786f63e7fab9406ad6 wasn't
actually testing anything, since the bug was with TZ aware attributes
only.
Merge tag 'tags/v4.2.0.rc2' into 4-2-stable

v4.2.0.rc2 release

I forgot to push this commit after doing the release, so the two branches
diverged.
Merge pull request #17975 from merongivian/add_test_for_search_field

Fix options overwritten by super
Merge pull request #17988 from caike/master

Add guides for `required` model generator option
Merge pull request #17970 from ulissesalmeida/foreign-type-has-many-has-one

Add foreign_type option for polymorphic has_one and has_many.
Conflicts:
	activerecord/CHANGELOG.md
No need to point to coffee-rails master when generating a edge app
Merge pull request #17793 from kamipo/fix_undesirable_range_error

Fix undesirable RangeError by Type::Integer. Add Type::UnsignedInteger.
Merge pull request #18000 from caike/master

Update guides with info about vendor/assets [ci skip]