title: How can I list items in rails for options_for_select?
body: <p>I'm using <code>rails 4</code> and I'd like to list categories in a select drop down menu. How can I do that? I have a form that looks like so:</p>
  
  <pre><code>&lt;%= f.select (:category_id), 
      options_for_select([ 
        ["Maths", 1],
        ["Physics", 2]
      ]) 
  %&gt; 
  </code></pre>
  
  <p>but of course, the content has to be dynamic from database, so I tried the following:</p>
  
  <pre><code>options_for_select([ 
    @categories.each do |c|
      [c.title, c.id]
    end
  ]) 
  </code></pre>
  
  <p>but that outputs <code>#&lt;Category:randomdigetshere&gt;</code> if I try to get the same output outside of that <code>options_for_select</code> it works and the title / id is being displayed as it should.</p>
  
  <p>What's the right way of doing it?</p>