I have two models, one that extends from the other.
I want to define a lifecycle callback in BaseObject
that all of the sub-models can inherit. But I don't know to get the name of the model being acted on inside the callback. Some of the sub-models will need this info. e.g.,
{
beforeCreate: function (model, next) {
// I want to know the model's identity in here
}
}
model
is just a straight key/value list of the model's attributes, but it does not contain any schema information, such as the model's name. this
seems to just point to global
. I have access to the global sails
object, but I don't know how to determine what this model is.
I ended up building this feature. I don't think it was possible before.