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"}}>
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---