From 0a29ec3adcdec71252ee0f675009fb61e1980a8f Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Sat, 26 Nov 2011 16:13:04 -0800 Subject: [PATCH] models setting --- lib/model.js | 1 + lib/plugins/models/index.js | 12 +++++++++--- lib/plugins/settings/setting.js | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/model.js b/lib/model.js index 7831118..fb9e091 100644 --- a/lib/model.js +++ b/lib/model.js @@ -366,6 +366,7 @@ Model = module.exports = emitter.spawn({ description: this.description, plugin: this.plugin, collection: this.collection, + name: this.name || this.collection, allowed: this.allowed }) .notify(function(json) { diff --git a/lib/plugins/models/index.js b/lib/plugins/models/index.js index 77d4797..4d66ee1 100644 --- a/lib/plugins/models/index.js +++ b/lib/plugins/models/index.js @@ -1,5 +1,5 @@ var Settings = require('../settings/settings') - , Setting = require('../settings/settings') + , Setting = require('../settings/setting') , Model = require('../../model') ; @@ -22,10 +22,16 @@ var refresh = module.exports.refresh = function() { // initial refresh refresh(); -// create or update general graph settings +// create or update general models settings Setting .spawn() - .set({plugin: 'models', name: 'models'}) + .unlock() + .set({ + plugin: 'models' + }) + .notify(function(json) { + console.log(json); + }) .save() ; diff --git a/lib/plugins/settings/setting.js b/lib/plugins/settings/setting.js index 85d7dcf..2e5ae1b 100644 --- a/lib/plugins/settings/setting.js +++ b/lib/plugins/settings/setting.js @@ -6,7 +6,9 @@ module.exports = Model.spawn({ plugin: 'settings', description: { + name: {type: 'string', unique: true, required: true}, plugin: 'string', + collection: 'string', description: 'object' },