var Application = require('../application');
var MyController = module.exports = function MyController(init) {
Application.call(this, init);
this.blah = 2; // I obviously was desperate and trying multiple options...
};
this.blah = 1; // I obviously was desperate and trying multiple options...
// This is a route defined in my routes file
MyController.prototype.test = function test(controller) {
console.log(this); // empty object
console.log(this.blah); // undefined, but I want to access this value... and no, I don't want to do var blah = 1;
return controller.send({success: true});
};
Caching = require 'caching'
module.exports = (compound)->
compound.controllerExtensions.cache = new Caching 'redis'
This is an example that might go in config/initializers/
You could use it in any controller action
by using c.cache as the "c" object is the current context the route is being evaluated with.