I'm making an app that retrieves data of an API which is not in my control. I have the following scenario:
The path for retrieving the posts is /api/posts
. So I configured my ApplicationAdapter as follows:
App.ApplicationAdapter = DS.RESTAdapter.extend({
namespace: 'api'
});
The url for retrieving comments is '/api/posts/1/comments'. You can see that the url is prefixed by the path for retrieving a single post
followed by the default path /comments
.
Ember data defaults to /api/comments
. But I want to configure an adapter for my Comment
-model so it makes the correct url: /api/posts/:post_id/comments
with :post_id
replaced with the id of the current post. How do I do that?
/api/posts/1/comments
just when you dopost.get('comments')
but when usingstore.find('comments')
, the url will be/api/comments
? – Marcio Junior