title: Backbone.js: calling render() from view's Initialize: function
body: <p>I want to my view to render itself when it is first created, so I am calling <code>this.render();</code> in the <code>initialize:</code> function, like this (some code removed):</p>
  
  <pre><code>var MyView = Backbone.View.extend({
  
      el: $("#mydiv"),
  
      initialize: function() {
          this.render();
      }
  ...
  </code></pre>
  
  <p>In the <code>render:</code> function I'm then looping through a child collection, and appending the rendered views of each child element:</p>
  
  <pre><code>render: function() {
      this.model.somecollection.forEach(function(c) {
          var view = new ChildView({ model: c });
          this.el.append(view.render().el); //*****
      });
      return this;
  },
  </code></pre>
  
  <p>The problem I'm having is that that the reference to <code>this</code> in the render function (marked with asterisks) is set to <code>window</code> rather than the <code>MyView</code> object, and it's causing an error.</p>
  
  <p>I assume I am calling render incorrectly (currently <code>this.render();</code> ).  How should I be doing this so that the <code>this</code> context is preserved?</p>