exports.definition = {
config : {
// table schema and adapter information
},
extendModel: function(Model) {
_.extend(Model.prototype, {
// Extend, override or implement the Backbone.Model methods
});
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {
// Implement the comparator method.
comparator : function(book) {
return book.get('title');
}
}); // end extend
return Collection;
}
}
Where should i specify url property to communicate with my rest service.
http://docs.appcelerator.com/titanium/latest/#!/guide/Alloy_Models
exports.definition = {
config: {
"columns": {
"username": "",
"password": ""
},
"defaults": {
"username": "-",
"password": "-"
},
"adapter": {
"type": "restapi",
"collection_name": "user"
}
},
extendModel: function(Model) {
_.extend(Model.prototype, {
**urlRoot**:'',
checkLogin: function(){
}
});
return Model;
},
extendCollection: function(Collection) {
_.extend(Collection.prototype, {
// Extend, override or implement Backbone.Collection
});
return Collection;
}
}
Backbone.sync method executes RESTful JSON requests to a URL specified by the Model.urlRoot or Collection.url attribute, when these classes are created. You can either specify in the Model or Collection
.