Fix error for aggregate methods with select, see issue #13648
fix exception on polymorphic associations with predicates
Merge pull request #14711 from swoker/activerecord_fix_aggregate_methods_with_select

Activerecord fix aggregate methods with select
:scissors:
New CHANGELOG entries are in to top of file
Use assert_not
Merge branch 'rm-fix-13648'

Includes https://github.com/rails/rails/pull/14711 and some cleanup
commits.

Fixes #13648