Fix support for custom association name in links generator

The test suite doesn’t fail, this is a good thing. I will do a pull request later that add some tests for this code. I didn’t do it on this one because I will refactor the "now huge" `links_resource_spec.rb` file.