DS.attr('json') and isDirty

I have made a JSON transform that looks like this

DS.Transform.extend({
  serialize: function (deserialized) {
    window.console.log('serialize', deserialized);
    return Em.isNone(deserialized) ? {} : deserialized;
  },
  deserialize: function (serialized) {
    window.console.log('deserialize', serialized);
    return Em.isNone(serialized) ? {} : serialized;
  }
});

And is used like this:

DS.Model.extend({
  meta: DS.attr('json')
});

My problem is that changing values within the meta object does not trigger the isDirty state on the model.

{{input value=model.meta.min}}

Typing in that input will not set the model to isDirty and thus changes won’t be saved. Anyone have any experience with setting JSON objects on models? Any help would be appreciated. Thanks.

Here’s a link to an example JSBIN. http://jsbin.com/poqoguyu/1/edit

1 Like