Skip to content
guilhermesilveira edited this page Jun 1, 2011 · 1 revision

Rendering links with hypertemplate

Restfulie uses hypertemplate to render links in media type representations. All documentation and samples from hypertemplate can be used in your templates.

Sample

The following example shows how to render a collection using tokamak, to generate a list of items and a link to both the collection and each one of the items:

products {
  link "order", orders_url, "type" => "application/xml"
  @products.each do |prod|
    product {
      link   :self,  product_url(prod)
      id prod.id
      name prod.name
      price prod.price
    }
  end
}
Clone this wiki locally