title: Rails: undefined method `+' for nil:NilClass
body: <p>I have this super simple code in my view:</p>
  
  <pre><code>&lt;% @something.each do |something| %&gt;
  
  &lt;% i = i+1 %&gt;
  
  &lt;div class="row"&gt;
  &lt;div class="span1"&gt;&lt;span class="badge untouched"&gt;&lt;%= i %&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>and get this error</p>
  
  <pre><code>undefined method `+' for nil:NilClass
  </code></pre>
  
  <p>I have the exact same code in another view and there it works!
  However, I'm new to rails and you see what I want to do. Maybe there is a more common way to increment an integer within an each loop?
  Where does this error come from?</p>
  
  <p>Thanks for any help!</p>