title: Build hash from collection of ActiveRecord Models
body: <p>I'm trying to build a hash from a Model.</p>
  
  <p>This is the type of hash I want to build.</p>
  
  <pre><code>{"United Sates" =&gt; "us", "United Kingdom" =&gt; "uk" .....}
  </code></pre>
  
  <p>I have tried so many ways now I'm just going around in circles.</p>
  
  <p>Here are just some of my poor attempts.</p>
  
  <pre><code>select = Array.new
  countries.each do |country|
    # select.push({country.name =&gt; country.code })
    # select[country.name][country.code]
  end
  
  h = {}
  
  countries.each do |c|
    # h[] = {c.name =&gt; c.code}
    # h[] ||= {} 
    # h[][:name] = c.name
    # h[][:code] = c.code 
    #h[r.grouping_id][:name] = r.name
    # h[r.grouping_id][:description] = r.description
  end
  </code></pre>
  
  <p>Please can some advise.</p>
  
  <p>Thank You</p>