I have this bit of code that when it runs, the server returns the created project with the correct ID and the ember inspector shows that the store has the model. But ember still seems to not have a true reference to the model
var store = this.get('store');
var prj = store.createRecord('project', this.blankProject.call(this));
var self = this;
self.get('model').addRecord(prj);
prj.save().then(function(prj){
prj.reload();
self.transitionToRoute('project', prj);
}, function(error){
Bootstrap.NM.push(error.message, 'danger');
});
After it saves, it transitions to the project route with the correct id but then i have code that saves a group on a project that looks like this.
var store = this.get('store');
var grp = store.createRecord('group', {});
var project = this.get('controllers.project.model');
grp.set('project', project);
grp.save().then(function(group){
project.get('groups').then(function(groups){
groups.addObject(group);
project.save().then(function(){
Bootstrap.ModalManager.close('addGroupModal');
});
});
});
The data is being saved to the db correctly and the group reference to the project is set to the correct id but it never shows up in my project view.
After I refresh the browser and reload the projects from the server then everything is okay.
Any ideas? This is blocking us from taking our application live.