title: How can I rename the keys so that they are underscored
body: <p>Here is a ruby hash:</p>
  
  <pre><code>a = {
    :testOne =&gt; 1,
    :testTwo =&gt; 2
  } 
  </code></pre>
  
  <p>How can I rename the keys so that they are underscored?</p>
  
  <pre><code>a = {
    :test_one =&gt; 1,
    :test_two =&gt; 2
  }
  </code></pre>
  
  <p>Ken Bloom got me on the right tract here. You do need ActiveSupport or Rails3. You don't need any specific gems for this solution however:</p>
  
  <pre><code>hash = Hash[a.map {|k,v| [k.to_s.underscore.to_sym, v]}]
  </code></pre>
  
  <p>Thanks ken!</p>