title: How do I count all objects of stages (one model) in the view of projects (another model) in Rails 3?
body: <p>This is related to my other question: <a href="https://stackoverflow.com/questions/4273877/how-do-i-show-all-the-stages-one-model-that-belong-to-a-project-another-model">How do I show all the stages (one model) that belong to a project (another model) in Rails 3?</a></p>
  
  <p>The only other addition to the code I would add is the updated version of the index view of my projects model:</p>
  
  <pre><code>&lt;h1&gt;Listing projects&lt;/h1&gt;
  
  &lt;table&gt;
    &lt;tr&gt;
      &lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
      &lt;th&gt;Number of Stages&lt;/th&gt;
    &lt;/tr&gt;
  
  &lt;% @projects.each do |project| %&gt;
      &lt;tr&gt;
          &lt;td&gt;&lt;%= link_to project.name, project %&gt; | &lt;/td&gt;
          &lt;td&gt;&lt;%= project.description %&gt; | &lt;/td&gt;
          &lt;td&gt;&lt;%#= stage.count %&gt;&lt;/td&gt;
  
          &lt;% if permitted_to? :edit, @project %&gt;
              &lt;td&gt;&lt;%= link_to 'Edit', edit_project_path(project) %&gt;&lt;/td&gt;
          &lt;% end %&gt;
  
          &lt;% if permitted_to? :destroy, @project %&gt;
              &lt;td&gt;&lt;%= link_to 'Destroy', project, :confirm =&gt; 'Are you sure?', :method =&gt; :delete %&gt;&lt;/td&gt;
          &lt;% end %&gt;
      &lt;/tr&gt;
  &lt;% end %&gt;
  &lt;/table&gt;
  
  &lt;br /&gt;
  
  &lt;% if permitted_to? :create, Project.new %&gt;
      &lt;%= link_to 'New Project', new_project_path %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Also, can you point me to a link in the Rails guides that can teach me about how to do this? </p>
  
  <p>Thanks.</p>