I’m using shallow nested routes (Rails) for some of my models. I’m able to access children records by including a links hash in the JSON returned object like so:
{
"companies": [
{
"id": 1,
"name": "Acme, Inc.",
"links": {
"locations": "/companies/1/locations"
},
"location_ids": [
1
]
}]
}
This works fine for GETs, but how would I do a POST against /companies/1/locations. Ember-Data tries to use /locations, which doesn’t exist. How do I get ember-data to use the links hash when creating a record?
BTW, my URLS look like so:
/companies/1/locations: GET
/companies/1/locations: POST
Then /locations/:id for PUT, GET (show), and DELETE