Forum: Ruby on Rails YAML wtf

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
9650515c4c5d1bd8680195d6f5d072e8?d=identicon&s=25 Frantisek Psotka (fero)
on 2007-07-10 11:55
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

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",
This topic is locked and can not be replied to.