# YAML wtf

**URL:** <https://www.ruby-forum.com/t/yaml-wtf/108988>\
**Category:** Rails\
**Created:** [July 10, 2007, 11:55am UTC](https://www.ruby-forum.com/t/yaml-wtf/108988 "2007-07-10T11:55:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/b2d939/32.png) [@fero](https://www.ruby-forum.com/u/fero)\
**Post date:** [July 10, 2007, 11:55am UTC](https://www.ruby-forum.com/t/yaml-wtf/108988/1 "2007-07-10T11:55:29Z")

</div>

I want to import and export something from a database, i use following  
code:

EXPORT:

```
objects['plans'] = Plan.find :all, :conditions=>['do < ?', @date]
result = objects.to_yaml

```

IMPORT:

```
objects = YAML::load file.read

```

so (if i am not wrong), the the objects array should be perfectly  
reconstructed, but it consist instead of Plan instances, of something  
else. When I call attribute, it throws:

```
undefined method `meno' for #<YAML::Object:0x3184414>

```

(meno is an attribute of Plan)

Please enlight this confusion. Here is few lines of exported file:

- !ruby/object:Plan  
attributes:  
do: “2007-05-31”  
firma: Kovstav  
meno: "Novy "  
id: “6”  
od: “2007-05-01”

And here is objects[element].inspect, after reconstruction

#{“do”=\>“2007-05-31”, “meno”=\>“Novy”, “firma”=\>“Kovstav”, “id”=\>“6”,  
“od”=\>“2007-05-01”}}\>
