0
votes

I am trying to add model to a hasmany relationship. In my route I have:

App.CourseRoute = Ember.Route.extend({
    model: function(){
        return this.store.find('course','-JNPcfHFQC8FNwyt_-Wh');
    }
});

and in my controller I have a save action:

App.CourseController=Ember.ObjectController.extend({
  actions: {
    save: function() {

         var _this = this;
         var course = this.get('model');
         _this.get('session').get('user').get("courses").pushObject(course)
         _this.get('session').get('user').save()

    }
  }
});

The session property refers a global sessions object that is injected into the controller. This project is using firebase and emberFire data adapter. No errors are being thrown and no data is updated on the firebase backend. I can't seem to figure out what is going on.

1

1 Answers

0
votes

Breakpoint your code before the save call and you'll probably see that this.get('session').get('user') has an isDirty property of false. So the save becomes a no-op. You can try to solve that by callingthis.get('session').get('user').notifyPropertyChange('courses').