Created a test for has_many :through presence validation issue

This PR creates a test for issue #9209. The test fails in the current master branch.