Frantisek Psotka wrote:>
> hello, please give me snipped, that reconstruct ActiveRecord object from
> YAML or Marshal.dump. When i type for example: YAML::load(item.to_yaml),
> the returned object is not (item''s class) Item. When i use:
> Marshal::load(Marshal::dump item), it throws exception "undefined
> class/module Item" How can I do this? Thanx.
At a guess, a model''s attributes member is very Hash-like, and Hashes
are also a native YAML type. So you _might_ store it with yaml_string
= model.attributes.to_yaml , and load that with model.attributes
YAML::load(yaml_string).
--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---