Sencha Touch model.save() and updating without additional load
I am wondering why I cannot do the following:
newChallenge = Ext.create('App.model.User', {name:'donald'});
newChallenge.save();
newChallenge.set('name','george');
newChallenge.save();
I don't see any errors in the log or updates in the DB.
Model:
Ext.define('App.model.User', {
extend: 'Ext.data.Model',
requires: [
'Ext.data.identifier.Uuid'
],
config: {
identifier: 'uuid',
fields: [
{ name: 'id', type: 'auto', persist: false },
{ name: 'name', type: 'string' }
]
proxy: {
type: 'rest',
api: {
create: App.util.Config.getApiUrl('user_profile'),
update: App.util.Config.getApiUrl('user_profile'),
read: App.util.Config.getApiUrl('user_profile')
},
reader: {
type: 'json'
},
writer: {
type: 'json-custom-writer-extended',
writeAllFields: true,
nameProperty: 'mapping'
}
}
}
});
Server Response (TastyPie):
{
"name":"george",
"id":35,
"resource_uri":"/app/api/1/user/35/",
"start_date":"2013-08-06T14:49:11.030298"
}
Thanks, Steve
No comments:
Post a Comment