title: How do I show the primary key in the index for ruby on rails?
body: <p>I'm new to ruby and picking it up a little slower than I would like.  I'm working with ruby 3.0.  For one of my tables in the database I created I want the primary key to show on the "index" page.  I'm having difficulty doing this.  I manually put the id in the index view, but it keeps on saying "undefined method `venture_round_id'"</p>
  
  <p>This is what my index.html looks like for the table:</p>
  
  <pre><code>&lt;h1&gt;Listing venture_rounds&lt;/h1&gt;
  &lt;table&gt;
  &lt;tr&gt;
  &lt;th&gt;id&lt;/th&gt;
  &lt;th&gt;company&lt;/th&gt;
  &lt;/tr&gt;
  &lt;% @venture_rounds.each do |venture_round| %&gt;
  &lt;tr&gt;
  &lt;td&gt;&lt;%= venture_round.venture_round_id %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= venture_round.company_id %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;% link_to 'show', venture_round %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= link_to 'Edit', edit_venture_round_path(venture_round) %&gt;&lt;/td&gt;
  &lt;td&gt;&lt;%= link_to 'Destroy', venture_round, method: :delete, data: { confirm: 'Are you sure?' } %&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;% end %&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I entered "venture_round_id" and "id" in manually.  </p>
  
  <p>This is what my controller looks like for the index:</p>
  
  <pre><code>def index
  @venture_rounds = VentureRound.all
  respond_to do |format|
  format.html # index.html.erb
  format.json { render json: @venture_rounds }
  end
  end
  </code></pre>
  
  <p>I've been researching this problem for two days now and haven't been able to find much about it.  I imagine the problem has something to do with accessing the key in its own table.  Other parts of my database structure that use venture_round_id as a foreign key work just fine.  Any pointers or tips would be greatly appreciated! </p>