Add public flag checking

This commit is contained in:
Ritchie Martori 2013-11-18 12:52:00 -08:00
parent 9eb44bdb59
commit ec58237f8a
2 changed files with 11 additions and 1 deletions

View File

@ -113,6 +113,13 @@ The following is an example of an object containing two `Model` definitions: "lo
Define a `Model` and export it for use by remote clients.
**definition**
- `public` - **default: true** attach the `Model` to the app and export its methods to clients
- `dataSource` - **required** the name of the `DataSource` to attach the `Model` to
**Example**
```js
// declare a DataSource
app.boot({

View File

@ -67,6 +67,7 @@ app.model = function (Model, config) {
return;
}
var modelName = Model;
config = config || {};
assert(typeof modelName === 'string', 'app.model(name, config) => "name" name must be a string');
Model =
@ -74,7 +75,9 @@ app.model = function (Model, config) {
this.models[classify(modelName)] =
this.models[camelize(modelName)] = modelFromConfig(modelName, config, this);
if(config.public !== false) {
this.model(Model);
}
return Model;
}