join association fix for issue #16436

I have made the fix for the issue https://github.com/rails/rails/issues/16436 please let me know your opinion on this and suggest appropriate edits.