Raise an error for has_one associations which try to go :through a polymorphic association [#17263]
Merge pull request #17267 from rebyn/master

Raise an error for has_one associations which try to go :through a polymorphic association
Use if/else instead of early raise