Skip to content

Instantly share code, notes, and snippets.

@fanktom
Created September 23, 2012 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanktom/3772889 to your computer and use it in GitHub Desktop.
Save fanktom/3772889 to your computer and use it in GitHub Desktop.
Scales API Partials
@partial_html = "<div>Just the Navigation</div>"
@partial_xml = "<track><name>Islandary</name><artist>Thomas Fankhauser</artist></track>"
@partial_json = '{ name : "Islandary", artist : "Thomas Fankhauser" }'
# Push a HTML Partial
Scales.push :html => @partial_html, :to => "navigation"
# Push a XML Partial
Scales.push :xml => @partial_xml, :to => "islandary.xml"
# Push a JSON Partial
Scales.push :json => @partial_json, :to => "islandary.json"
# Use the HTML Partial
@html = '
<html>
<head></head>
<body>
Scales.partial "navigation"
</body>
</html>
'
# Use the XML Partial
@xml = '
<tracks>
Scales.partial "islandary.xml"
</tracks>
'
# Use the JSON Partial
@json = '
[
Scales.partial "islandary.json"
]
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment