title: ActiveRecord converts symbol keys to strings when serializing my hash
body: <p>I have a Rails model class with a serialized Hash attribute, like this:</p>
  
  <pre><code>class Action
    serialize :metadata, Hash
    # . . .
  end
  </code></pre>
  
  <p>That column is stored in a <code>text</code> column with a YAML encoding. The problem is that when I pass a <code>metadata</code> value to the <code>create!</code> method, the hash keys are converted from symbols to strings, but that conversion doesn't happen other times. For example:</p>
  
  <pre><code>$ rails console
  &gt; a = Action.create!(:metadata =&gt; {:foo =&gt; "bar"})
  &gt; a.metadata
   =&gt; {"foo"=&gt;"bar"}
  &gt; a.metadata[:fizz] = "buzz"
  &gt; a.metadata
   =&gt; {"foo"=&gt;"bar", :fizz=&gt;"buzz"}
  </code></pre>
  
  <p>Now when I save the model, the database is going to have this text value:</p>
  
  <pre><code>---
  foo: bar
  :fizz: buzz
  </code></pre>
  
  <p>Any suggestions how to fix this?</p>
  
  <p>(This is with Rails 3.0.16.)</p>