Model Class
isClass()
Signature
Section titled “Signature”isClass() — returns string
Available in: model
Category: Miscellaneous Functions
Description
Section titled “Description”Determines whether the method is being called at the class level (on the model itself) or on an instance of the model. This is useful when the same function can be invoked either on a model object or directly on the model class.
Examples
Section titled “Examples”1. Use the passed in `id` when we're already in an instance
function memberIsAdmin(){
if(isClass()){
return this.findByKey(arguments.id).admin;
} else {
return this.admin;
}
}