It looks like an error in Ember (still in the latest v1.0) ... you cannot pass the variable to the helper inside #each or get: -
TypeError: Object.defineProperty called on non-object
I just found a workaround using the contents of options.data, but that means you need to quote the object you pass if it is inside #each (note the “color” instead of the color below)
Template:
<ul>
<li>{{helpme color 'lorry'}}</li>
{{#each color in model}}
<li>{{helpme 'color' 'lorry'}}</li>
{{/each}}
</ul>
Helper:
Ember.Handlebars.helper('helpme', function (color, vehicle, opts) {
var str = color;
if (typeof opts.data.keywords[color] === 'string') {
str = opts.data.keywords[color];
}
return new Ember.Handlebars.SafeString(str + '_' + vehicle);
});
... . JSFiddle
EDIT: Ember Ember.Handlebars.registerHelper()
Ember.Handlebars.helper()