title: Rails - Get value by specifying the column name
body: <p>How do I get the value of one field from the a result? Here what I got so far:</p>
  
  <p>This gives me the right value when I use row[8]:</p>
  
  <pre><code>&lt;% @result.each{|row| %&gt;
     &lt;tr&gt;
       &lt;% row.each{|key| %&gt;
         &lt;td&gt;&lt;%= key %&gt;&lt;/td&gt;
       &lt;% } %&gt;
         &lt;td&gt;&lt;%= row[1] %&gt;&lt;/td&gt;
     &lt;/tr&gt;
  &lt;% } %&gt;
  </code></pre>
  
  <p>However, I'm trying to get the value by column name. Using row["the_column_name"] doesn't seem to work as it returns "can't convert String into Integer". I think it's erroring because this is an array. How would I get the value by referencing the column name?</p>