Merge pull request #12829 from iantropov/issue_insert_via_hmt_scope_3548

Fix insertion of records for hmt association with scope

Conflicts:
	activerecord/CHANGELOG.md

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation.rb