method should first be invoked on CollectionProxy

This is fix for https://github.com/rails/rails/issues/9994

I will write test for it once the fix looks ok .