Class Index | File Index

Classes


Class JsModel#instance

A single instance of a Model
Defined in: js_model.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Instances of a Model
Field Summary
Field Attributes Field Name and Description
<static>  
JsModel#instance.parentClass
instances get their parentClass assigned this model
Method Summary
Method Attributes Method Name and Description
<static>  
JsModel#instance.destroy()
destroy this instance - works just like rails #destroy will fire off the destroy event as well controllers will receive this event by default
<static>  
JsModel#instance.get(key)
Use this to retreive attributes on an object (rather than accessing them directly);
<static>  
JsModel#instance.observe(key, func)
listen to an attribute of a model
<static>  
JsModel#instance.primaryKey()
You should always use this to refer to instances.
<static>  
JsModel#instance.set(key, value)
Use this to set attributes of an instance (rather than set them directly).
<static>  
JsModel#instance.touch(key)
Use to manually fire a change event on an attribute.
<static>  
JsModel#instance.updateAttributes(obj)
Take an Object literal and update all attributes on this instance
Class Detail
JsModel#instance()
Instances of a Model
See:
MBX.Constructor
Field Detail
<static> {JsModel} JsModel#instance.parentClass
instances get their parentClass assigned this model
Method Detail
<static> JsModel#instance.destroy()
destroy this instance - works just like rails #destroy will fire off the destroy event as well controllers will receive this event by default

<static> JsModel#instance.get(key)
Use this to retreive attributes on an object (rather than accessing them directly);
              modelInstance.set('myAttr', 'foo');
              modelInstance.get('myAttr', 'foo');
Parameters:
{String} key

<static> JsModel#instance.observe(key, func)
listen to an attribute of a model
Parameters:
key
func
Returns:
an EventHandler subscription object
See:
MBX.EventHandler

<static> JsModel#instance.primaryKey()
You should always use this to refer to instances. Model.find uses this to grab objects from the instances
Returns:
returns the primaryKey of the instance
See:
JsModel.find

<static> JsModel#instance.set(key, value)
Use this to set attributes of an instance (rather than set them directly). It will automatically create events that will be relevant to controllers
              modelInstance.set('myAttr', 'foo');
              modelInstance.get('myAttr', 'foo');
Parameters:
{String} key
the key of the attribute
value
the value to be assigned to the attribute

<static> JsModel#instance.touch(key)
Use to manually fire a change event on an attribute.
              modelInstance.touch("myAttr");
Parameters:
{String} key
the key of the attribute you want to fire the enent on

<static> JsModel#instance.updateAttributes(obj)
Take an Object literal and update all attributes on this instance
Parameters:
{Object} obj
the attributes to update as key, value

Documentation generated by JsDoc Toolkit 2.1.0 on Tue Dec 08 2009 14:00:29 GMT-0500 (EST)