View Full Version : Child association not being PUT with parent

25 Jul 2012, 6:58 AM

My record has some child records in one of its associations, however I can see the PUT rest request to save() the parent is not posting the children in the JSON request.


Is there something that I should know about? Are foreign keys mandatory for this to work?

Ext.define('Pegfect.model.Pegfile', {

extend: 'Ext.data.Model',

fields: ['Id', 'Reference'],

idProperty: 'Id',

hasMany: {
model: 'Pegfect.model.Response',
associationKey: 'Responses',
name: 'responses'

type: 'rest',
url: 'Pegfile',
timeout: 120000,
noCache: false,

type: 'json',
root: 'data',
successProperty: 'success'

type: 'json',
writeAllFields: true

25 Jul 2012, 8:09 AM
The solution here seems (http://www.sencha.com/forum/showthread.php?141957-Saving-objects-that-are-linked-hasMany-relation-with-a-single-Store/page3) to work, just wondering if the framework offers us any possibilities?

25 Jul 2012, 12:56 PM
Correct, the framework (in it's current form) does not send child associations with the parent model via POST/GET or whatever method of saving you use.

I have heard rumors that this is something coming eventually... but don't ask me when because I honestly don't know if/when it would happen.

I have been pointing people to the thread you mentioned, so just use that for now if it does the job.