Skip to content

Commit

Permalink
Change sails.config.controllers.actions to `sails.config.controller…
Browse files Browse the repository at this point in the history
…s.moduleDefinitions`.
  • Loading branch information
sgress454 committed Oct 21, 2016
1 parent 56efaf7 commit 4ad23dd
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/app/private/controller/load-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ module.exports = function (results, cb) {
sails.log.warn('----------------------------------------------------------------------------\n');
}

// Merge stuff from sails.config.controllers.actions on top of any loaded files.
_.each(_.get(sails, 'config.controllers.actions') || {}, function(action, actionIdentity) {
// Merge stuff from sails.config.controllers.moduleDefinitions on top of any loaded files.
_.each(_.get(sails, 'config.controllers.moduleDefinitions') || {}, function(action, actionIdentity) {
sails._controller.registerAction(action, actionIdentity, true);
});

Expand Down
2 changes: 1 addition & 1 deletion test/integration/hook.blueprints.action.routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('blueprints :: ', function() {
},
log: {level: 'error'},
controllers: {
actions: {
moduleDefinitions: {
'toplevellegacy/fnaction': function (req, res) { res.send('legacy fn action!'); },
'toplevellegacy/machineaction': { exits: {success: {example: 'abc123'} }, fn: function (inputs, exits) { exits.success('legacy machine action!'); } },
'top-level-standalone-fn': function (req, res) { res.send('top level standalone fn!'); },
Expand Down
2 changes: 1 addition & 1 deletion test/integration/hook.blueprints.index.routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('blueprints :: ', function() {
},
log: {level: 'error'},
controllers: {
actions: {
moduleDefinitions: {
'index': function (req, res) { res.send('top-level index!'); },
'secondlevel/index': function (req, res) { res.send('second-level index!'); },
'thirdlevel/index': function (req, res) { res.send('third-level index!'); },
Expand Down
2 changes: 1 addition & 1 deletion test/integration/hook.blueprints.restful.routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ describe('blueprints :: ', function() {
}
},
controllers: {
actions: {
moduleDefinitions: {
'user/find': function(req, res) {
return res.send('find dem users!');
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/hook.blueprints.shortcut.routes.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ describe('blueprints :: ', function() {
}
},
controllers: {
actions: {
moduleDefinitions: {
'user/find': function(req, res) {
return res.send('find dem users!');
}
Expand Down
6 changes: 3 additions & 3 deletions test/integration/hook.policies.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('policies :: ', function() {
},
log: {level: 'silent'},
controllers: {
actions: {
moduleDefinitions: {
'user': function(req, res) { return res.send('user'); },
'user/foo': function(req, res) { return res.send('user.foo'); },
'user/foo/bar': function(req, res) { return res.send('user.foo.bar'); }
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('policies :: ', function() {
},
log: {level: 'silent'},
controllers: {
actions: {
moduleDefinitions: {
'user': function(req, res) { return res.json({action: 'user', animals: {cat: req.options.cat, owl: req.options.owl}}); },
'user/foo': function(req, res) { return res.json({action: 'user.foo', animals: {cat: req.options.cat, owl: req.options.owl}}); },
'user/foo/bar': function(req, res) { return res.json({action: 'user.foo.bar', animals: {cat: req.options.cat, owl: req.options.owl}}); }
Expand Down Expand Up @@ -503,7 +503,7 @@ describe('policies :: ', function() {
},
log: {level: 'silent'},
controllers: {
actions: {
moduleDefinitions: {
'user': function(req, res) { return res.json({action: 'user', foo: req.options.foo, animals: {cat: req.options.cat, owl: req.options.owl}}); },
'user/foo': function(req, res) { return res.json({action: 'user/foo', foo: req.options.foo, animals: {cat: req.options.cat, owl: req.options.owl}}); },
'user/foo/bar': function(req, res) { return res.json({action: 'user/foo/bar', foo: req.options.foo, animals: {cat: req.options.cat, owl: req.options.owl}}); }
Expand Down

0 comments on commit 4ad23dd

Please sign in to comment.