Merge pull request #8313 from alan/only_save_changed_has_one_objects

Save has_one associations only if record has changes

Conflicts:
	activerecord/CHANGELOG.md

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/autosave_association.rb
Review CHANGELOGs [ci skip]
Fixes STI when 2+ levels deep.

PR #14052 Added a regression where it was only looking for methods in one
level up, So when the method was defined in a 2+ levels up the
inheritance chain, the method was not found as defined.

Conflicts:
	activerecord/test/cases/attribute_methods_test.rb