Check out this code, this is my model:
App.Partita = DS.Model.extend({
data: DS.attr('string'),
ora: DS.attr('string'),
evento: DS.attr('string'),
segno: DS.attr('string'),
quota: DS.attr('number'),
vinto: DS.attr('boolean', false),
giocata: DS.attr('number'),
vincita: DS.attr('number'),
cassa: DS.attr('number'),
remove: DS.attr('boolean', false),
remover: function () {
this.deleteRecord();
this.save();
}.observes('remove', true),
vintoChange: function () {
console.log(this);
console.log(this.get('isDirty'));
if(!this.get('isDirty'))
this.save();
}.observes('vinto')
});
and I'm using localstorage adapter for the data:
App.LSAdapter = DS.LSAdapter.extend({
namespace: 'app_namespace'
});
App.ApplicationAdapter = DS.LSAdapter;
I don't know why but when the function "vintoChange" is triggered, I always get that the data is dirty even if it was saved before with
.get('model').save();
Can someone explain?