YAML wtf

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


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


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
    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”,