Cannot add new object to hasMany?


#1

I am trying to add object to a hasMany realtionship. I tried this (selected variable contains id of achievement object to be added):

var ach = this.get("store").find("achievement", selected);
this.get("model.achievements").pushObject(ach);

This code fails with addedRecord is undefined.

What am I doing wrong?

I use:

DEBUG: Ember             : 1.13.3 vendor.js:14790:5
DEBUG: Ember Data        : 1.13.9 vendor.js:14790:5
DEBUG: jQuery            : 2.1.4 vendor.js:14790:5
DEBUG: Model Fragments   : 1.13.1 vendor.js:14790:5
DEBUG: Ember Simple Auth : 1.0.0