I have route :
model: function(params) {
return this.store.findRecord('singleUser', params.user_id, {reload: true});
},
setupController: function(controller, model) {
this._super(controller, model);
this.store.find('userNetwork', {userId: model.id});
},
And two models:
models/single-user.js
userNetworks: DS.hasMany('userNetwork', {async: true})
models/user-network.js
singleUser: DS.belongsTo('singleUser'),
after that my model makes request to server:
GET "server/api/userNetworks?userId=270".
response from the server:
{"singleUsers":{"userNetworks":[40]}}
it's right, but makes another one request:
GET "server/app_dev.php/api/userNetworks/40".
Help me. Why is this happening ?
Ember v1.13.7 Ember-data v1.13.9
find
in anafterModel
, rather thansetupController
. That way you're sure that it's done loading before the transition is finalized and the template is rendered. – user663031