Fixing multi-word automatic inverse detection.

Currently, ActiveRecord models with multiple words cannot have their
inverse associations detected automatically.
Merge pull request #11897 from wangjohn/fixing_multiple_word_inverse_detection

Fixing multi-word automatic inverse detection.
Fixed `columns_for_distinct` of postgresql adapter