Skip to content

Instantly share code, notes, and snippets.

@joshsmith
Last active August 29, 2015 14:02
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 joshsmith/f395082056b618d6a660 to your computer and use it in GitHub Desktop.
Save joshsmith/f395082056b618d6a660 to your computer and use it in GitHub Desktop.
Recipe = DS.Model.extend
title: DS.attr('string')
steps: DS.hasMany('step', {async: true})
Step = DS.Model.extend
substeps: DS.hasMany('substep', {async: true})
Substep = DS.Model.extend()
<h1>{{title}}</h1>
<ul>
{{#each step in steps}}
<li>{{id}}</li>
<ul>
{{#each substep in substeps}}
<li>{{id}}</li>
{{/each}}
</ul>
{{/each}}
</ul>
{
"steps": [
{
"id": 1,
"substep_ids": [
1,
2
]
}
],
"substeps": [
{
"id": 1
},
{
"id": 2
}
],
"recipes": [
{
"id": 1,
"title": "Scrambled Eggs",
"step_ids": [
1
]
}
]
}
{
"recipes": [
{
"id":1,
"title":"Scrambled Eggs"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment