Allow generate link for itself

This is a first try to generate links for a resource. It's not tested yet, but should work for one resource. However I have no idea about how this could work for associations or any other links... :(