model.values

values

model.unset

unsetmodel.unset(attribute, [options]) Remove an attribute by deleting it from the internal attributes hash. Fires a "change" event unless silent is passed as an option.

model.sync

syncmodel.sync(method, model, [options]) Uses Backbone.sync to persist the state of a model to the server. Can be overridden for custom behavior.

model.url

urlmodel.url() Returns the relative URL where the model's resource would be located on the server. If your models are located somewhere else, override this method with the correct logic. Generates URLs of the form: "[collection.url]/[id]" by default, but you may override by specifying an explicit urlRoot if the model's collection shouldn't be taken into account. Delegates to Collection#url to generate the URL, so make sure that you have it defined, or a urlRoot property, if all models of th

model.toJSON

toJSONmodel.toJSON([options]) Return a shallow copy of the model's attributes for JSON stringification. This can be used for persistence, serialization, or for augmentation before being sent to the server. The name of this method is a bit confusing, as it doesn't actually return a JSON string â but I'm afraid that it's the way that the JavaScript API for JSON.stringify works. var artist = new Backbone.Model({ firstName: "Wassily", lastName: "Kandinsky" }); artist.set({birthday: "Dec

model.set

setmodel.set(attributes, [options]) Set a hash of attributes (one or many) on the model. If any of the attributes change the model's state, a "change" event will be triggered on the model. Change events for specific attributes are also triggered, and you can bind to those as well, for example: change:title, and change:content. You may also pass individual keys and values. note.set({title: "March 20", content: "In his eyes she eclipses..."}); book.set("title", "A Scandal in Bohemia");

model.previousAttributes

previousAttributesmodel.previousAttributes() Return a copy of the model's previous attributes. Useful for getting a diff between versions of a model, or getting back to a valid state after an error occurs.

model.save

savemodel.save([attributes], [options]) Save a model to your database (or alternative persistence layer), by delegating to Backbone.sync. Returns a jqXHR if validation is successful and false otherwise. The attributes hash (as in set) should contain the attributes you'd like to change â keys that aren't mentioned won't be altered â but, a complete representation of the resource will be sent to the server. As with set, you may pass individual keys and values instead of a hash. If the mod

model.parse

parsemodel.parse(response, options) parse is called whenever a model's data is returned by the server, in fetch, and save. The function is passed the raw response object, and should return the attributes hash to be set on the model. The default implementation is a no-op, simply passing through the JSON response. Override this if you need to work with a preexisting API, or better namespace your responses. If you're working with a Rails backend that has a version prior to 3.1, you'll notice th

model.previous

previousmodel.previous(attribute) During a "change" event, this method can be used to get the previous value of a changed attribute. var bill = new Backbone.Model({ name: "Bill Smith" }); bill.on("change:name", function(model, name) { alert("Changed name from " + bill.previous("name") + " to " + name); }); bill.set({name : "Bill Jones"});