title: Attempting to utilize a drop down menu in a form in ruby on rails
body: <p>First off, I'm pretty new to Ruby and Ruby on rails, so bear with me.</p>
  
  <p>I'm attempting to have my categories section of my form utilize my category table in my db so that when the author wants to select on a category, they can just select the drop down menu and choose one. For now, I've hard coded them and this works</p>
  
  <pre><code>&lt;%= form_for(@article) do |f| %&gt;
    &lt;% if @article.errors.any? %&gt;
      &lt;div id="error_explanation"&gt;
        &lt;h2&gt;&lt;%= pluralize(@article.errors.count, "error") %&gt; prohibited this article from being saved:&lt;/h2&gt;
  
  
      &lt;ul&gt;
        &lt;% @article.errors.full_messages.each do |message| %&gt;
          &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;
        &lt;% end %&gt;
        &lt;/ul&gt;
      &lt;/div&gt;
    &lt;% end %&gt;
  
    &lt;div class="field"&gt;
      &lt;%= f.label :title %&gt;&lt;br&gt;
      &lt;%= f.text_field :title %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :content %&gt;&lt;br&gt;
      &lt;%= f.text_area :content %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :author_id %&gt;&lt;br&gt;
      &lt;%= f.text_field :author_id %&gt;
    &lt;/div&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :category_id %&gt;&lt;br&gt;
      &lt;%= f.select (:title), [['Finance'], ['Marketing'], ['Programming'], ['Leisure'], ['Management'], ['Food']] %&gt;
    &lt;/div&gt;
    &lt;div class="actions"&gt;
      &lt;%= f.submit %&gt;
    &lt;/div&gt;
  
  &lt;% end %&gt;
  </code></pre>
  
  <p>but, by switching the categories section to </p>
  
  <pre><code>&lt;div class="field"&gt;
      &lt;%= f.label :category_id %&gt;&lt;br&gt;
      &lt;%= f.select :category_id, Category.all %&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>it will give me a drop down box containing each hash, and I'm not to sure why, but I can't do Category.all.name to get the names (I'm assuming it is because it's in a hash). Any help would be great appreciated. </p>