ember.js - Ember changedAttributes() not show boolean change -


i've been trying store list of changes model model before saving it, can recall changes undo previous changes. code i'm using:

var changes = item.changedattributes(); var newundo = this.store.createrecord('undo', {   item_id: item.get('id'),   changes: changes }); 

and checkbox typical one:

{{input type="checkbox" checked=checked class="checkbox"}} 

i have component checkbox sends save action when checked changes, , controller's save method calling code above when before saving record:

import ember 'ember'; export default ember.component.extend({   checked: false,   model: null,   watchchecked: function () {     this.sendaction('save', this.get('model'))   }.observes('checked') }); 

and undo model

import ds "ember-data";  export default ds.model.extend({   item_id: ds.attr('number'),   changes: ds.attr('string') }); 

this works string attributes, boolean checkboxes, it's not acting expected. i'm seeing:

page load, unchecked item checked:

changes: {} 

then unchecked:

changes: {print_copy_sent: true,true} 

then checked again:

changes: {print_copy_sent: false,false} 


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -