# YAML fails when has\_one is null

**URL:** <https://www.ruby-forum.com/t/yaml-fails-when-has-one-is-null/105344>\
**Category:** Rails\
**Created:** [May 29, 2007, 3:24am UTC](https://www.ruby-forum.com/t/yaml-fails-when-has-one-is-null/105344 "2007-05-29T03:24:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [May 29, 2007, 3:24am UTC](https://www.ruby-forum.com/t/yaml-fails-when-has-one-is-null/105344/1 "2007-05-29T03:24:35Z")

</div>

My model has\_one :association

If I call model.to\_yaml (or y model) in the console, and the  
association is nil, I get a yaml error. Anyone else get this? Is  
this a confirmed bug?

---

<div class="post-metadata">

**Author:** ![robertjames](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e9c0ed/32.png) [@robertjames](https://www.ruby-forum.com/u/robertjames)\
**Post date:** [May 29, 2007, 8:23pm UTC](https://www.ruby-forum.com/t/yaml-fails-when-has-one-is-null/105344/2 "2007-05-29T20:23:21Z")

</div>

On 5/28/07, S. Robert J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My model has\_one :association
> 
> If I call model.to\_yaml (or y model) in the console, and the  
> association is nil, I get a yaml error. Anyone else get this? Is  
> this a confirmed bug?

Yes, looks like a known problem:

[http://dev.rubyonrails.org/ticket/8016](http://dev.rubyonrails.org/ticket/8016)
