Closed dsawardekar closed 10 years ago
Currently, there is not a notion of child resources in terms of url structure. I think this is a totally valid use case and would like to support it soon. At the moment, however, epf would expect the parent post to serialize a list of comment ids which would be loaded via the top level /comment/ID
Ok I see, so I must embed/sideload.
Can you clarify the sequence of calls Epf would send out in the following scenario?
Lets say you have a /posts
which loads the top 10 posts. The call for this is made via session.query('post', ...)
. The post
has comment_ids
embedded.
Would Epf make a single call with multiple IDs or multiple calls for each comment_id
? Also at what point would this call be triggered? At `post.get('comments') access, or is there a manual load call that I need to make in a route perhaps?
Thanks for your help.
At the moment epf would make multiple calls for each comment_id. The way to optimize this is to use sideloading/embedding to pre-emptively load associations like that.
As far as when it its triggered: this will happen when any of the properties of the members of the association are observed.
Hi,
I am working on a custom adapter for Epf. I have a question regarding how the
RestAdapter
builds URLs that are used to make the ajax calls. I see that theRestAdapter
usesbuildURL
to build the url given to thethis.ajax
function.My question is how does
Epf
construct the URL for a nested resource like/posts/1/comments
. Say/posts
has yielded a collection of posts and the comments aren't sideloaded or embedded. How does Epf go about building the URL for loading thecomments
for Post with id=1?There is a
url
property on theRestAdapter
that is prefixed to every call. But isn't this for setting a customDomain
alongside thenamespace
? I can't locate the code that prefixes the parent resource to the url. Can you please point me in the right direction?Thanks.