A list of properties that are omitted from the Backbone.Model.prototype
, to create
a generic model base.
List of attributes attached directly from the options
passed to the constructor.
The "ModelBase" is similar to the 'Active Model' in Rails, it defines a standard interface from which other objects may inherit.
Similar to the standard Backbone
set method, but without individual
change events, and adding different meaning to changed
and previousAttributes
defined as the last "sync"'ed state of the model.
Handle both "key", value
and {key: value}
-style arguments.
Extract attributes and options.
Check for changes of id
.
For each set
attribute, update or delete the current value.
Returns an object containing a shallow copy of the model attributes,
along with the toJSON
value of any relations,
unless {shallow: true}
is passed in the options
.
parse converts a response into the hash of attributes to be set
on
the model. The default implementation is just to pass the response along.
format converts a model into the values that should be saved into the database table. The default implementation is just to pass the data along.
Returns the related item, or creates a new related item by creating a new model or collection.
Create a new model with identical attributes to this one, including any relations on the current model.
Sets the timestamps before saving the model.
Called after a sync
action (save, fetch, delete) -
resets the _previousAttributes
and changed
hash for the model.
Destroy a model, calling a "delete" based on its idAttribute
.
A "destroying" and "destroyed" are triggered on the model before
and after the model is destroyed, respectively. If an error is thrown
during the "destroying" event, the model will not be destroyed.
Helper to mixin one or more additional items to the current prototype.
Base Model