Fixes nested has_many links in JSONAPI

When linked resource had has_many links, all of them would use the
association from the first resource, causing all of the items to build
`links` with the same associations.

This fixes it by iterating over the serializers, not just the
attributes array.
Merge pull request #730 from rails-api/fixes-nested-has-many-links

Fixes nested has_many links in JSONAPI