Merge pull request #15208 from sgrif/sg-delegate-type-cast-for-write

Delegate `type_cast_for_write` to injected type object
fix variable names, only pass hashes to the positional args method
fewer hash allocations when calling url_for
fewer method calls and string garbage when there is no user/password
push arg checking up
push only_path conditional up
mutate the path string to avoid object allocations
fewer string allocations per url_for
we don't use this parameter for anything, so rm
Merge pull request #15154 from msgehard/move_password_field

Put attr_reader in with all of the other instance methods
Prevented belongs_to: touch propagating up if there are no changes being saved
Delegate `klass` to the injected type object
Revert "Revert "Merge pull request #8313 from alan/only_save_changed_has_one_objects""

This reverts commit e94e6c27af495a2460c811bb506459f1428dec6b.

Conflicts:
	activerecord/CHANGELOG.md

The original commit was reverted only to be safe since #14407 were reported.
We don't have any proof we added a regression with the original commit
so reverting it now will give us more problem.

Closes #14407
Merge pull request #14979 from brocktimus/master

Making belongs_to: touch behaviour be consistent with save updating updated_at
Merge pull request #15205 from sgrif/sg-delegate-klass

Delegate `klass` to the injected type object
Merge pull request #14544 from jefflai2/named_scope_sti

Fixes Issue #13466.

Conflicts:
	activerecord/CHANGELOG.md
Merge pull request #10887 from sakuro/deep_transform_keys_in_nested_arrays

Hash#deep_*_keys(!) recurse into nested arrays.

Conflicts:
	activesupport/CHANGELOG.md
Remove redundant code.
Merge pull request #15213 from tgxworld/remove_redundant_code

Remove redundant code.
Fix polymorphic eager load with foreign_key as String.

The foreign_key could be `String` and just doing `owners_map[owner_key]`
could return `nil`.
To prevent this bug, we should `to_s` both keys if their types are
different.

Fixes #14734.