title: Rails with Backbone.js and Handlebars
body: <p>About my app:<br>
  - I use Rails 3.2.6 with backbone.js(backbone-on-rails gem) and handlebars template engine.<br>
  - Created a routes, and views, works great. My view:</p>
  
  <pre><code>  el: $('#lorem'),
    render: function(){
      var js = this.collection.toJSON();
      var template = Handlebars.compile($("#lorem2").html());
      $(this.el).html(template({articles: js}));
      console.log(js);
      return this;
    }
  </code></pre>
  
  <p>-I created a template (in assets dir: assets/templates/peoples/index.hbs):</p>
  
  <pre><code>&lt;script id="lorem2" type="text/x-handlebars-template"&gt;
      {{#each articles}}
         {{this.name}}
       {{/each}}
  &lt;/script&gt;
  </code></pre>
  
  <p>When I refresh the page, I get this error message: </p>
  
  <p><em>Uncaught TypeError: Cannot call method 'match' of null</em> </p>
  
  <p>I think the template file maybe wrong:  </p>
  
  <pre><code>&lt;script src="/assets/templates/people/index.js?body=1" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>this contains:</p>
  
  <pre><code>    (function() {
              this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
              this.HandlebarsTemplates["people/index"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
    helpers = helpers || Handlebars.helpers;
    var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
  
  
    buffer += "&lt;div class=\"entry\"&gt;\n  &lt;h1&gt;";
    foundHelper = helpers.title;
    stack1 = foundHelper || depth0.title;
    if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
    else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "title", { hash: {} }); }
    buffer += escapeExpression(stack1) + "&lt;/h1&gt;\n  &lt;div class=\"body\"&gt;\n    ";
    foundHelper = helpers.body;
    stack1 = foundHelper || depth0.body;
    if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
    else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "body", { hash: {} }); }
    if(stack1 || stack1 === 0) { buffer += stack1; }
    buffer += "\n  &lt;/div&gt;\n&lt;/div&gt;\n";
    return buffer;});
              return HandlebarsTemplates["people/index"];
            }).call(this);
  </code></pre>