title: Passing local variable to partial inside for each loop rails 3
body: <p>This is my code for rendering the partial (the @parties collection is being generated correctly, I have tested that):</p>
  
  <pre><code>        &lt;% @parties.each do |party| %&gt;
              &lt;div class="item"&gt;
                &lt;%= render 'parties/party', :object =&gt; party  %&gt;
              &lt;/div&gt;
          &lt;% end %&gt;
  </code></pre>
  
  <p>And this is the code in the partial:</p>
  
  <pre><code>&lt;%= party.name %&gt;
  </code></pre>
  
  <p>However, I get the following error:</p>
  
  <pre><code>undefined method `name' for nil:NilClass
  </code></pre>
  
  <p>I'm at my wits end, someone please help :-|</p>
  
  <p>Also, this is the code for the controller to render the view containing the partial (The controller's called default_controller):</p>
  
  <pre><code>def index
      @parties = Party.all
  end
  </code></pre>
  
  <p>Is it of any consequence that this isn't the parties_controller?</p>