# YAML serialization

**URL:** <https://www.ruby-forum.com/t/yaml-serialization/92342>\
**Category:** Rails\
**Created:** [April 18, 2007, 2:34pm UTC](https://www.ruby-forum.com/t/yaml-serialization/92342 "2007-04-18T14:34:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florian\_ASSSSmann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/48db29/32.png) [@Florian\_ASSSSmann](https://www.ruby-forum.com/u/Florian_ASSSSmann)\
**Post date:** [April 18, 2007, 2:34pm UTC](https://www.ruby-forum.com/t/yaml-serialization/92342/1 "2007-04-18T14:34:44Z")

</div>

Hi,

something wrong with ActiveRecord or YAML? They don’t put Strings  
into Quotes when it serializes. This gave me trouble when I  
serialized a String with a double colon (eg. ‘key: value’). After AR  
unserialized the Value it became a Hash since a String ‘key: value’  
becomes attribute[:key] =\> value… ☹

Sincerely  
Florian

---

<div class="post-metadata">

**Author:** ![Florian\_ASSSSmann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/48db29/32.png) [@Florian\_ASSSSmann](https://www.ruby-forum.com/u/Florian_ASSSSmann)\
**Post date:** [April 19, 2007, 1:36am UTC](https://www.ruby-forum.com/t/yaml-serialization/92342/2 "2007-04-19T01:36:17Z")

</div>

Florian Aßmann wrote:

> something wrong with ActiveRecord or YAML? They don’t put Strings  
> into Quotes when it serializes. This gave me trouble when I  
> serialized a String with a double colon (eg. ‘key: value’). After AR  
> unserialized the Value it became a Hash since a String ‘key: value’  
> becomes attribute[:key] =\> value… ☹

Yes, this is an ActiveRecord bug. It’s not YAMLizing String objects  
when writing to the DB, but is de-YAMLizing when reading from the DB.

–  
We develop, watch us RoR, in numbers too big to ignore.
