View Full Version : Weird call to reader in HasOne & BelongsTo association classes

mono blaine
21 Jun 2012, 5:03 AM
I'm trying to load some nested data into a model with associations for a month, to no avail. The read method of both HasOne and BelongsTo association classes makes a call to the read method of the associated reader instance (the argument of which is sent to the readRecords method of the reader):

* Read associated data
* @private
* @param {Ext.data.Model} record The record we're writing to
* @param {Ext.data.reader.Reader} reader The reader for the associated model
* @param {Object} associationData The raw associated data
read: function(record, reader, associationData){
record[this.instanceName] = reader.read([associationData]).records[0];

However, for some reason, the associationData is passed within an array, and that's the problem I have been suffering. Because my associationData is something like:

GenericModel: {
id: 0
success: true

and I guess this is what the reader of the associated Model class is supposed to take. So, if the associationData is passed within an array to the readRecords method of the Reader class, the operation fails silently. If you instead pass the associationData directly, the problem disappears. Is this a bug?