lib/hypermodel/empty_collection.rb
def links
      url = @controller.request.url
      url = url.split('.')[0..-2].join('.') if url =~ /\.\w+$/

      parent_url  = url.split('/')[0..-2].join('/')
      parent_name = parent_url.split('/')[0..-2].last.singularize

      _links = {
        self: { href: url },
        parent_name => { href: parent_url }
      }

      { _links: _links }
    end
def links
      url = @controller.request.url
      url = url.split('.')[0..-2].join('.') if url =~ /\.\w+$/

      parent_url  = url.split('/')[0..-2].join('/')
      parent_name = parent_url.split('/')[0..-2].last.singularize

      _links = {
        self: { href: url },
        parent_name => { href: parent_url }
      }

      { _links: _links }
    end
def links url = @controller . request . url url = url . split ( '.' ) [ 0 .. - 2 ] . join ( '.' ) if url =~ / \. \w / parent_url = url . split ( '/' ) [ 0 .. - 2 ] . join ( '/' ) parent_name = parent_url . split ( '/' ) [ 0 .. - 2 ] . last . singularize _links = { self : { href : url } , parent_name => { href : parent_url } } { _links : _links } end
Internal: Constructs the _links section of the response.

 Returns a Hash of the links of the collection. It will include, at least,
 a link to itself.
Internal : Constructs the _links section of the response .