title: XML Serialization issue in ActiveRecord serializable attributes
body: <p>I have a serialized field called options(of type Hash) in my User model. The options field behaves like a Hash most of the time. When I convert the user object to XML, the 'options' field is serialized as a YAML type instead of Hash. </p>
  
  <p>I am sending the result to a Flash client via REST. This behaviour is causing problems at the client side. Is there a way to address this?</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    serialize :options, Hash
  end
  
  u = User.first
  u.options[:theme] =  "Foo"
  u.save
  
  p u.options # prints the Hash
  
  u.to_xml    # options is serialized as a yaml type: 
              # &lt;options type=\"yaml\"&gt;--- \n:theme: Foo\n&lt;/options&gt;
  </code></pre>
  
  <h1>EDIT:</h1>
  
  <p>I am working around this issue by passing a block to to_xml.(similar to the solution suggested by molf)</p>
  
  <pre><code>u.to_xml(:except =&gt; [:options])  do |xml|
    u.options.to_xml(:builder =&gt; xml, :skip_instruct =&gt; true, :root =&gt; 'options')
  end
  </code></pre>
  
  <p>I wondering if there is a better way.</p>