I'm running Ember 1.0 with Ember Data 1.0 Canary using FixtureAdapter. One of my routes will load its model correctly the first time I enter it, but any subsequent time the data will be empty. Here is that route:
App.PlannerRoute = App.AuthenticatedRoute.extend({
model: function() {
var snapshotId,
scenarioController = this.controllerFor('scenario'),
snapshot = scenarioController.get('selectedSnapshot'),
scenario = scenarioController.get('content');
if ( !snapshot ) {
if ( !scenario )
this.transitionTo('scenarios');
else
this.transitionTo('scenario', scenario);
}
snapshotId = snapshot.get('id');
return Ember.Object.create({
regions: this.store.find('region', { snapshot: snapshotId }),
networks: this.store.find('networks', { snapshot: snapshotId }),
terminals: this.store.find('terminals', { snapshot: snapshotId })
});
}
});
If I set a break point at the return statement in the model method above, I find that the calls to this.store.find
always retrieve the correct data. However, the data is only populated into the route's controllers/views/templates/etc on the first transition to the route.
Any assistance in tracking down the problem is appreciated. How can I fix this?