Skip to content

Instantly share code, notes, and snippets.

@istro
Last active January 2, 2016 15:59
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 istro/8327387 to your computer and use it in GitHub Desktop.
Save istro/8327387 to your computer and use it in GitHub Desktop.
expected json format:
GET /locations/
{ locations: [
{
'id': 1,
'name': 'foo',
'postal': '123',
'roomIds': [1,2,3]
},
{
'id': 2,
'name': 'bar',
'postal': '123',
'roomIds': [3,4,5]
}
]}
------------------
GET /locations/1
{ location: {
'id': 1,
'name': 'foo',
'postal': '123',
'roomIds': [1,2,3]
}
}
------------------
GET /locations/1/rooms/23
{ room: {
'id': '23',
'name': 'kitchen',
etc.
...
'locationId': '1', <<<<<---- for belongsTo, need the owner's id in singular
'lightIds': [1,2,3]
}
}
--------------------
final gotcha - on "create" action we need to return the saved object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment