Skip to content

Commit

Permalink
added instance() method
Browse files Browse the repository at this point in the history
  • Loading branch information
olalonde committed Jun 5, 2013
1 parent 0c6073e commit a5adfcc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/BaseController.js
Expand Up @@ -8,6 +8,24 @@ BaseController.extend = function(buildHelper) {
Controller.prototype.actions = {};
Controller.prototype.beforeFilters = [];
Controller.prototype.callStack_ = [];
Controller.instance = function (req, res, next) {
//@TODO: mock req/res/next objects?
return (new Controller(req, res, next));
}
//Controller.action = function (action, req, res, cb) {
//if (typeof res === 'function') {
//cb = res;
//res = {
//render: function () {},
//send: function () {},
//end: function () {},
//format: function () {},
//json: function () {}
//};
//}
//var ctl = new Controller(req, res, cb);
//ctl.action(action);
//}
Controller.extend = this.extend;

// Execute buildHelper function
Expand All @@ -16,6 +34,7 @@ BaseController.extend = function(buildHelper) {

return Controller;
}

/**
* Call action actionName. This will also call any before filter that apply.
*/
Expand Down

0 comments on commit a5adfcc

Please sign in to comment.