title: Array to hash of key value pairs in ruby
body: <p>From a model that returns all the values from a table, how would I convert that to a hash of name value pairs</p>
  
  <pre><code>{column_value =&gt; column_value}
  </code></pre>
  
  <p>e.g.    </p>
  
  <pre><code>[{:id =&gt; 1, :name =&gt; 'first'}, {:id =&gt; 2, :name =&gt; 'second'}, {:id =&gt; 3, :name =&gt; 'third'}]
  </code></pre>
  
  <p>to (specifying :id and :name)</p>
  
  <pre><code>{'first' =&gt; 1, 'second' =&gt; 2, 'third' =&gt; 3}
  </code></pre>