You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var page = DS.Model.extend({
categories: DS.hasMany('category', {async: true}),
});
var category= DS.Model.extend({
page: DS.belongsTo('page', {async: true})
});
In Parse I have relevant columns:
I have page pointer type from category -> page
I have categories array of category objectId's on each page.
When I have instance of page and try this method:
page.get('categories')
or call (in template to iterate):
page.categories
Parse data adapter makes individual GET requests for each categories.
ie: say for example Page has categories array set as ["dyutrdf23", "44fdfdf"]
will make two requests to get the categories.
I modified model hook on Categories route to make one request to fetch all page categories:
However, I don't understand why this method (findHasMany) is not being called (for one request with query as opposed to individual requests) when I make the page.get('categories').
Maybe I've overlooked something with Ember data/Ember parse adapter here.
Any feedback appreciated. Thank you.
The text was updated successfully, but these errors were encountered:
ghost
changed the title
Two requests BelongsTo
multiple requests hasMany relationship
May 12, 2015
I simplified code to show relevant issue.
Ember data models:
In Parse I have relevant columns:
I have page pointer type from category -> page
I have categories array of category objectId's on each page.
When I have instance of page and try this method:
or call (in template to iterate):
Parse data adapter makes individual GET requests for each categories.
ie: say for example Page has categories array set as ["dyutrdf23", "44fdfdf"]
will make two requests to get the categories.
I modified model hook on Categories route to make one request to fetch all page categories:
This works, I used it from https://github.com/clintjhill/ember-parse-adapter/blob/master/addon/adapters/application.js#L130.
However, I don't understand why this method (findHasMany) is not being called (for one request with query as opposed to individual requests) when I make the page.get('categories').
Maybe I've overlooked something with Ember data/Ember parse adapter here.
Any feedback appreciated. Thank you.
The text was updated successfully, but these errors were encountered: