jaredhanson/locomotive — Issue #3: alter code before and after to accept array actions
Author: andersonloyola
Created: 2012-02-25 15:27:46+00:00
State: open

Sample:

PagesController.before(new Array("show","main") , function(next) {
this.title = 'Test';
this.user = this.req.user;
next();
});

Changed the code Controller.js

Before
if (action.constructor === Array) {
_this = this;
action.forEach(function (value) {
_this.pre(value, filter);
});
} else {
this.pre(action, filter);
}

After

if (action.constructor === Array) {
_this = this;
action.forEach(function (value) {
_this.post(value, filter);
});
} else {
this.post(action, filter);
}