samedi 2 mai 2015

Ember-data in more complex routes

I have an Ember-data model called goal where the list view maps back to the RESTful API at:

GET /api/users/[id]/goal

and a singular goal record would map to:

GET /api/users/[id]/goal/[goalId]

What I'm wondering is ... what's the most graceful way of configuring this using ember-data's RESTAdapter? What I've done so far is set the application adapter (aka, adapters/application.js) to a namespace of 'api' so that offset is taken care of.

What I'm not sure of is how to ensure that the /users/[id] part of the URL is included. Obviously this is a dynamic segment which makes it more complicated although I suspect its actually not hard at all but I'm just not sure how to get started.




Aucun commentaire:

Enregistrer un commentaire