I'm having issues creating model associations using "reference" on a field. The association I'm trying to achieve is a one-to-many. The "many" part does not know about the "one" part, since it could be a many for another model.
Company has many Emails
Person has many Emails
By using the old way with "hasMany", I would write something like this:
The server sends this as the json response:
After loading the data, I get a store with Email records that is being referenced in the Company record, which is what I want.
"Name": "Abc Inc.",
Now I'm not sure on how to achieve this by replacing the "hasMany" with the new way which is to add a reference to a field.
Here is my unsuccessful attempt:
This gives me the Company record but instead of giving me a reference to a store it only gives me the first email as a record.
Here is a fiddle to demonstrate this:
My understanding is that what I'm doing here sets up a many-to-one association instead of one-to-many. Can anyone tell me if this is wrong, and what is the right way to do this?
I'm using ExtJS 5.0.1