code: def links
        _links = { self: polymorphic_url(record_with_ancestor_chain(@record)) }
  
        resources.each do |name, resource|
          _links.update(name => polymorphic_url(record_with_ancestor_chain(resource)))
        end
  
        sub_resources.each do |sub_resource|
          _links.update(sub_resource => polymorphic_url(record_with_ancestor_chain(@record) << sub_resource))
        end
  
        { _links: _links }
      end
docs: Internal: Constructs the _links section of the response.
  
   Returns a Hash of the links of the resource. It will include, at least,
   a link to itself.