Hi friends: I tried to convert a model object to yaml(use to_yaml method), and after that, I would like to convert the yaml(string type) back to the model object. But when I use YAML::load to do that, it failed, the return object''s class is Yaml class, not my prior model class.. Please tell me how can I do to convert yaml to an object as the prior model class, or how can I access the content of the model object by this yaml? Thank you ! Tony Shih -- 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 -~----------~----~----~----~------~----~------~--~---
Try this: http://www.humandoing.net/past/2007/2/15/deserialize_objects_from_yaml/ On Apr 16, 12:41 pm, Shih Tony <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi friends: > > I tried to convert a model object to yaml(use to_yaml method), and after > that, I would like to convert the yaml(string type) back to the model > object. But when I use YAML::load to do that, it failed, the return > object''s class is Yaml class, not my prior model class.. Please tell me > how can I do to convert yaml to an object as the prior model class, or > how can I access the content of the model object by this yaml? > > Thank you ! > > Tony Shih > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---
Clever Neologism wrote:> Try this: > > http://www.humandoing.net/past/2007/2/15/deserialize_objects_from_yaml/ > > On Apr 16, 12:41 pm, Shih Tony <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>It looks great.. Thank you very much! -- 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 -~----------~----~----~----~------~----~------~--~---