My Ember Data model needs to be autosaved whenever any of its fields change. Although I have been using the autosave plugin, it doesn't work properly with JSON fields.
The model's fields are structured like this:
title: DS.attr('string'),
options: DS.attr(),
Changing the title
attribute triggers the setUnknownProperty
method in the ObjectProxy
used by the plugin, but changing subfields like options.layout
does not. This means those changes do not trigger autosave.
I attempted setting observers on all properties within the options
object as a workaround. However, when the model is saved and reloaded from the server, it causes an endless loop as the observers fire again upon reloading.
What other solutions can I explore in this situation?