KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Say I have the following ember-data model: App.Person = DS.Model.extend({ firstName: DS.attr('string'), lastName: DS.attr('string'), starred: DS.attr('boolean') }); This communicates with a Rails app with the following pretty standard CRUD API: GET /people - get a list of people POST /people - create a new person GET /people/id - get a specific person PUT /people/id - update a specific person DELETE /people/id - delete a specific person This all maps to Ember-Data with the standard Store/Adapter. However, lets say that in order to "star" or "unstar" a person, the API doesn't let us do this by the standard update action. There's a specific API endpoint for this action: POST /people/id/star - mark a person as "starred" POST /people/id/unstar - mark a person as "unstarred" How do I fit this API in with Ember Data? It looks like I'd need to extend DS.Store and DS.RESTAdapter somehow, but I'm not sure of the best approach to make them aware of these different actions. It also feels a bit wrong that a generic Adapter for the app has to be aware of starring people. Note that I have no control over the API, so I can't make POST /people/id aware of "starring" so that it would fit in with a standard update.
Tags (comma-separated)
Save Edits
Cancel