quangv / hulk-hogan

Hogan.js for Express with support for Template Partials.
MIT License
37 stars 2 forks source link

Fix for missing '_readFile' method: change to fat arrow for __express method #11

Closed christopherscott closed 12 years ago

christopherscott commented 12 years ago

Previously, apps were crashing with 500 TypeError: Object # has no method '_readFile'. Artifact of refactor, where express function was moved to a method on the 'HulkHogan' class. Since application authors hand over express method to the framework, the 'this' value was being lost. Changing to a fat-arrow binds this to the HulkHogan instance, and a reference to @_readfile is restored.

christopherscott commented 12 years ago

This fixed the error for me.

ghost commented 12 years ago

It did work. Losing the 'this' value here seems not that good. And thanks @christopherscott .