Fix links for associated records.

Fixes #3941
Merge pull request #3949 from cakephp/issue-3941

Fix links for associated records.