title: custom Handlebars helper - parameter is not resolved
body: <pre><code># here is CreditCards controller context
  {{#with controllers.currentCardCategory}}
    {{#each property in cardProperties}}
      {{#is property.symbol 'your_savings'}}
        &lt;td class="td"&gt;{{yourSavings}}&lt;/td&gt;
      {{else}}
        &lt;td class="td"&gt;{{cardProperty this property.symbol}}&lt;/td&gt;
      {{/is}}
    {{/each}}
  {{/with}}
  </code></pre>
  
  <p>I create the table dynamically. All content comes from <code>ArrayController</code> except one that is a computed property that comes from the controller. <code>symbol' field is underscored like</code>annual_fee' and belongs to <code>CreditCardProperty</code>. Each card category has different set of card properties. Only two categories have properties (category has many card properties) and one record has <code>computed</code> field set to <code>true</code>. That means that the template should look up the corresponding controller.</p>
  
  <p>As <code>symbol</code> (e.g age_to_apply) relates to one of the CreditCard fields (<code>ageToApply</code>) all I could to figure out was to use the <code>cardProperty</code> helper which takes current card in the context (<code>this</code>) and resolves <code>property.symbol</code>, e.g:</p>
  
  <pre><code>camelizedProperty = categoryProperty.camelize()
  card.get 'camelizedProperty'
  </code></pre>
  
  <p>Ideally I'd like to do without the helper and use it somehow like this:</p>
  
  <pre><code># *** {{property.symbol}} should look up this context
  #     and become e.g {{annual_fee}} or {{annualFee}} - is it possible?
  {{#with controllers.currentCardCategory}}
    {{#each property in cardProperties}}
      &lt;td class="td"&gt;{{property.symbol}}***&lt;/td&gt;
    {{/each}}
  {{/with}}
  </code></pre>
  
  <p>But the problem is that I don't know how can I render that '{{yourSavings}}' part. The helper you can see comes from <a href="http://elving.github.io/swag/" rel="nofollow noreferrer">swag collection of Handlebars helpers</a>. The helper, unfortunately does not resolve properties so that <code>property.symbol</code> becomes a string.</p>
  
  <p>Here it is:</p>
  
  <pre><code>Handlebars.registerHelper 'is', (value, test, options) -&gt;
    if value is test then options.fn(@) else options.inverse(@)
  </code></pre>
  
  <p>I think it is possible but <a href="https://stackoverflow.com/questions/18004510/whats-the-difference-between-handlebars-helpers-and-ember-handlebars-helpers">with the right helper</a> - don't know which one, though.</p>
  
  <p>What I do would like to avoid is to resort to computed property like <code>if isYourSavings</code>.</p>