Skip to content

Instantly share code, notes, and snippets.

@wanderer
Created June 23, 2013 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wanderer/5846873 to your computer and use it in GitHub Desktop.
Save wanderer/5846873 to your computer and use it in GitHub Desktop.
IN: lib/hooks/index
// Mix in middleware from blueprints
if(_.isUndefined(controller.find))
controller.find = Controller.find;
if(_.isUndefined(controller.create))
Controller.create = Controller.create;
if(_.isUndefined(controller.update))
controller.update = Controller.update;
if(_.isUndefined(controller.destroy))
controller.destroy = Controller.destroy;
OR
_.defaults(controller, Controller);
INSTEAD OF
self.middleware[controllerId].find = Controller.find;
self.middleware[controllerId].create = Controller.create;
self.middleware[controllerId].update = Controller.update;
self.middleware[controllerId].destroy = Controller.destroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment