Skip to content

Commit

Permalink
Fix async helpers losing proper "this" context
Browse files Browse the repository at this point in the history
Fixes #1357

- Instead of calling the passed function directly, use .call(this,
  options)
  • Loading branch information
jgable committed Oct 31, 2013
1 parent 0005d76 commit 257169e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/ghost.js
Expand Up @@ -287,7 +287,7 @@ Ghost.prototype.registerAsyncThemeHelper = function (name, fn) {
hbs.registerAsyncHelper(name, function (options, cb) {
// Wrap the function passed in with a when.resolve so it can
// return either a promise or a value
when.resolve(fn(options)).then(function (result) {
when.resolve(fn.call(this, options)).then(function (result) {
cb(result);
}).otherwise(function (err) {
errors.logAndThrowError(err, "registerAsyncThemeHelper: " + name);
Expand Down

0 comments on commit 257169e

Please sign in to comment.