Skip to content

Instantly share code, notes, and snippets.

@sebyx07
Created August 11, 2016 17:41
Show Gist options
  • Save sebyx07/2157fc7dfc41651bd0968a1597b94ed4 to your computer and use it in GitHub Desktop.
Save sebyx07/2157fc7dfc41651bd0968a1597b94ed4 to your computer and use it in GitHub Desktop.
//store-todo.js
import DS from 'ember-data';
export default DS.Model.extend({
description: DS.attr('string'),
name: DS.attr('string'),
storeTodoStatuses: DS.hasMany('store-todo-status')
});
//store-todo-status.js
import DS from 'ember-data';
export default DS.Model.extend({
completed: DS.attr('boolean'),
storeTodo: DS.belongsTo('store-todo'),
cStore: DS.belongsTo('store')
});
{
"data":[
{
"id":"1",
"type":"store-todo-statuses",
"links":{
"self":"http://localhost:3000/api/v1/store-todo-statuses/1"
},
"attributes":{
"completed":false
},
"relationships":{
"store":{
"links":{
"self":"http://localhost:3000/api/v1/store-todo-statuses/1/relationships/store",
"related":"http://localhost:3000/api/v1/store-todo-statuses/1/store"
}
},
"store-todo":{
"links":{
"self":"http://localhost:3000/api/v1/store-todo-statuses/1/relationships/store-todo",
"related":"http://localhost:3000/api/v1/store-todo-statuses/1/store-todo"
},
"data":{
"type":"store-todos",
"id":"1"
}
}
}
}
],
"included":[
{
"id":"1",
"type":"store-todos",
"links":{
"self":"http://localhost:3000/api/v1/store-todos/1"
},
"attributes":{
"name":"Todo",
"description":"Do that"
},
"relationships":{
"store-todo-statuses":{
"links":{
"self":"http://localhost:3000/api/v1/store-todos/1/relationships/store-todo-statuses",
"related":"http://localhost:3000/api/v1/store-todos/1/store-todo-statuses"
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment