View Full Version : Saving a model with a hasOne association

7 Mar 2013, 12:09 PM
Is saving a model with a hasOne association supported yet? I found some old posts from around a year ago saying that it wasn't yet...

I'm trying it in 4.1, and when I save a model (using a json/rest proxy) it passes along all the normal fields, but doesn't do anything with the association. I was hoping that on save, it would bundle the hasOne association's data along with the request as well.

I can post code if necessary, but I'm really just wondering if this is supported at all.

7 Mar 2013, 10:40 PM
You can have a serialize function for the hasOne field. In the serialize method you return the json data of the associated model.

name : 'test',
serialize : function(value, record) {
return value.getData();