title: Show selected name instead of ID in rails index view
body: <p>So I'm a newbie at rails and I'm trying as best as I can follow tutorials that abound the web.  So I have three tables.</p>
  
  <pre><code>  class CreateAuthors &lt;
       ActiveRecord::Migration   def self.up
           create_table :authors do |t|
             t.string :name
             t.string :email
  
             t.timestamps
           end
  
         end
  
         def self.down
           drop_table :authors end end
  
  
   class CreateTopics &lt;
   ActiveRecord::Migration   def self.up
       create_table :topics do |t|
         t.string :category
  
         t.timestamps
       end   end
  
     def self.down
       drop_table :topics 
     end
  end
  </code></pre>
  
  <p>Now the Articles reference the author_id and topic_id </p>
  
  <pre><code>class CreateArticles &lt;
   ActiveRecord::Migration   def self.up
       create_table :articles do |t|
         t.string :title
         t.integer :author_id
         t.integer :topic_id
         t.text :content
         t.integer :status
  
         t.timestamps
       end   end
  
     def self.down
       drop_table :articles   end end
  </code></pre>
  
  <p>Now for the new.html.erb and edit.html.erb I found out how to use collection_select to get the records from the topics and authors. </p>
  
  <pre><code>&lt;% form_for(@article) do |f| %&gt;
    &lt;%= f.error_messages %&gt;
  
    &lt;p&gt;
      &lt;%= f.label :title %&gt;&lt;br /&gt;
      &lt;%= f.text_field :title %&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;%= f.label :author_id %&gt;&lt;br /&gt;
      &lt;%= @authors =Author.find(:all, :order =&gt; 'name')
      collection_select(:article,:author_id, @authors,:id,:name) %&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;%= f.label :topic_id %&gt;&lt;br /&gt;
      &lt;%= @topics = Topic.find(:all, :order =&gt; 'category') 
          collection_select(:article,:topic_id, @topics,:id,:category) %&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;%= f.label :content %&gt;&lt;br /&gt;
      &lt;%= f.text_area :content %&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;%= f.label :status %&gt;&lt;br /&gt;
      &lt;%= f.text_field :status %&gt;
    &lt;/p&gt;
    &lt;p&gt;
      &lt;%= f.submit 'Create' %&gt;
    &lt;/p&gt;
  &lt;% end %&gt;
  
  &lt;%= link_to 'Back', articles_path %&gt;
  </code></pre>
  
  <p>Now for my view how do I return the names in the index and show view and not the id?</p>
  
  <pre><code>&lt;td&gt;&lt;%=h article.topic_id %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%=h article.title %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%=h article.author_id %&gt;&lt;/td&gt;
      &lt;td&gt;&lt;%=h article.status %&gt;&lt;/td&gt;
  </code></pre>
  
  <p>Any help would be grateful.</p>