# Question about yaml. Thank you!

**URL:** <https://www.ruby-forum.com/t/question-about-yaml-thank-you/134974>\
**Category:** Rails\
**Created:** [April 16, 2008, 6:41pm UTC](https://www.ruby-forum.com/t/question-about-yaml-thank-you/134974 "2008-04-16T18:41:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![beexk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e5b9ba/32.png) [@beexk](https://www.ruby-forum.com/u/beexk)\
**Post date:** [April 16, 2008, 6:41pm UTC](https://www.ruby-forum.com/t/question-about-yaml-thank-you/134974/1 "2008-04-16T18:41:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![beexk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e5b9ba/32.png) [@beexk](https://www.ruby-forum.com/u/beexk)\
**Post date:** [April 16, 2008, 7:20pm UTC](https://www.ruby-forum.com/t/question-about-yaml-thank-you/134974/2 "2008-04-16T19:20:12Z")

</div>

Try this:

[http://www.humandoing.net/past/2007/2/15/deserialize\_objects\_from\_yaml/](http://www.humandoing.net/past/2007/2/15/deserialize_objects_from_yaml/)

On Apr 16, 12:41 pm, Shih T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![beexk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e5b9ba/32.png) [@beexk](https://www.ruby-forum.com/u/beexk)\
**Post date:** [April 17, 2008, 5:04am UTC](https://www.ruby-forum.com/t/question-about-yaml-thank-you/134974/3 "2008-04-17T05:04:56Z")

</div>

Clever N. wrote:

> Try this:
> 
> [http://www.humandoing.net/past/2007/2/15/deserialize\_objects\_from\_yaml/](http://www.humandoing.net/past/2007/2/15/deserialize_objects_from_yaml/)
> 
> On Apr 16, 12:41 pm, Shih T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

It looks great… Thank you very much!
