I have a qtrRecord that is part of a subjectRecord and I want to create a new subjectRecord. I have tried the following code, but it does not add the data to the subjectRecord. I tried using the subjectRecord.set() function as indicated in the Ext.data.Model documentation, but it appears not to be part of the subjectRecord object when I run it in the debugger.

Can someone point me in the right direction. Perhaps some could just provide a simple example of how to get a hold of the model in a controller and then to add a record to it and store in my store. My store is using a rest proxy.

Please help. I have been trying to figure this out for two days.

Code:
debugger;var subjectRecord, studentRecord, myQtrName, qtrRecord;
subjectRecord    = this.getSubjectRecord( subjectName );
studentRecord    = this.getStudentRecord( userName );
myQtrName        = this.getQuarterName( quarterNameIntValue );
qtrRecord        = this.getQuarterRecord( myQtrName, qtr_year);




if( typeof qtrRecord == "undefined" )
{
    qtrRecord = this.getModel( 'quarters.QuarterModel' );
    qtrRecord.set( { 
        qtrName: myQtrName, 
        qtr_year: qtr_year, 
        gradeType: gradeTypeIntValue, 
        grade: 0, 
        locked: 0, 
        whoUpdated: 'application', 
        lastUpdated: new Date(),
        student: studentRecord
    } );
}
if( typeof subjectRecord == "undefined" )
{
    subjectRecord = this.getModel( 'subject.SubjectsModel' );
    subjectRecord.create( {
        name: subjectName,
        gradeLevel: gradeLevel,
        creditHours: creditHours,
        completed: 0,
        whoUpdate: 'application',
        lastUpdated: new Date(),
        description: description,
        objectives: objectives,
        quarter: qtrRecord,
        userName: userName
    });
}
else
{
    subjectRecord.set( 'quarter', qtrRecord );
}
Code:
Ext.define('MySchool.model.quarters.QuarterModel', {    extend: 'Ext.data.Model',


    uses: [
        'MySchool.model.subject.SubjectsModel',
        'MySchool.model.student.StudentModel'
    ],


    fields: [
        {
            name: 'qtrName',
            type: 'string'
        },
        {
            name: 'qtr_year',
            type: 'string'
        },
        {
            name: 'gradeType',
            type: 'int'
        },
        {
            name: 'grade',
            type: 'int'
        },
        {
            name: 'locked',
            type: 'boolean'
        },
        {
            name: 'whoUpdated',
            type: 'string'
        },
        {
            name: 'lastUpdated',
            type: 'date'
        }
    ],


    hasMany: {
        model: 'MySchool.model.subject.SubjectsModel',
        autoLoad: true,
        reader: {
            type: 'json',
            root: 'data'
        }
    },


    hasOne: {
        model: 'MySchool.model.student.StudentModel',
        reader: {
            type: 'json',
            root: 'data'
        }
    },


    belongsTo: {
        model: 'MySchool.model.student.StudentModel',
        reader: {
            type: 'json',
            root: 'data'
        }
    }
});
Code:
Ext.define('MySchool.store.quarter.QuarterStore', {    extend: 'Ext.data.Store',


    requires: [
        'MySchool.model.quarters.QuarterModel'
    ],


    constructor: function(cfg) {
        var me = this;
        cfg = cfg || {};
        me.callParent([Ext.apply({
            autoLoad: true,
            model: 'MySchool.model.quarters.QuarterModel',
            storeId: 'quarter.QuarterStore',
            proxy: {
                type: 'rest',
                url: 'quarters',
                headers: {
                    Accept: 'application/json'
                },
                reader: {
                    type: 'json',
                    root: 'data'
                }
            }
        }, cfg)]);
    }
});
Code:
Ext.define('MySchool.controller.subject.SubjectsController', {    extend: 'Ext.app.Controller',


    selectedIndex: '0',
    models: [
        'subject.SubjectsModel',
        'quarters.QuarterModel',
        'student.StudentModel',
        'subject.QuarterNamesModel'
    ],
    stores: [
        'subject.SubjectStore',
        'quarter.QuarterStore',
        'student.StudentStore',
        'subject.GradeTypeStore'
    ],
    views: [
        'MainPanel',
        'subject.SubjectsGridPanel',
        'subject.SubjectsForm',
        'subject.SubjectsPanel',
        'subject.GradeTypeComboBox',
        'subject.QuarterNamesComboBox'
    ],