These are my two models with a hasMany relationship
Eidos.Form = DS.Model.extend({
name: DS.attr(‘string’),
items: DS.hasMany(‘item’)
});
Eidos.Item = DS.Model.extend({
qtitle: DS.attr(‘string’),
qhelp: DS.attr(‘string’),
qoption: DS.attr(‘string’),
form: DS.belongsTo(‘form’)
});
My router.js file is
Eidos.Router.map(function() {
// this.resource('posts');
this.resource('forms', function(){
this.resource('form',{path: ':form_id'},function(){
this.resource('editor', function(){
this.route('additem');
});
});
});
});
What i would like to do is , whenver i am accessing forms/:id/editor/additem url, i would like to create an ‘Item record’ and have it associated with the ‘id’ of the form. That means i would like to create child items(A form hasmany items) for that particular id of the form. I don’t know how to access the model hook for the parent model. Can anyone help me with this.