Merge pull request #12918 from versioncontrol/rails-12866

Checks to see if the record contains the foreign_key to set the inverse automatically

Conflicts:
	activerecord/CHANGELOG.md

Conflicts:
	activerecord/CHANGELOG.md