title: Coffeescript 'this' inside jQuery .each()
body: <p>I have some coffeescript like the following:</p>
  
  <pre><code>class foo:
      @bar = 'bob loblaw'
  
      processRows: -&gt;
          $("#my-table&gt;tr").each -&gt;
              id = $(this).attr("id")
              @processRow id
  
      processRow: (id) -&gt;
          console.log @bar + id
  </code></pre>
  
  <p>So my problem is: I need <code>this</code> to reference the <code>.each</code> context inside the loop to get at <code>id</code>, but I also would like <code>this</code> to reference the class instance inside <code>foo.processRow()</code>---which it does not currently do. </p>
  
  <p>Using something like <code>_this = this</code> outside the <code>.each</code> function and passing it around isn't a great solution, either, since I reference many class variables inside <code>processRow</code>.</p>
  
  <p>Any thoughts? Am I missing something obvious? Thanks!</p>