I am using Ember Data beta2 and I have a hasMany relationship set up.
When creating a child record do I have to use pushObject on the parent's corresponding property?
When looking at the documentation I get the impression that I need to correctly set the record's parent property and save it.
This is how I do it:
addPlugin: function() {
//get the value
var title = this.get('newPluginName');
if (!title.trim()) { return; }
var plugin = {
name: title,
category: this.get('model'),
url: ''
};
var plugin = this.store.createRecord('plugin', plugin);
plugin.save();
//clear the text field
this.set('newPluginName', '');
$("#new-plugin").blur();
}
I see the newly created record in the Ember inspector in Chrome, it is not dirty, but it is not present in the parent listing and after I refresh it is gone.