# To\_yaml problem with option hash

**URL:** <https://www.ruby-forum.com/t/to-yaml-problem-with-option-hash/64284>\
**Category:** Rails\
**Created:** [June 23, 2006, 8:19pm UTC](https://www.ruby-forum.com/t/to-yaml-problem-with-option-hash/64284 "2006-06-23T20:19:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bas](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a587f6/32.png) [@Bas](https://www.ruby-forum.com/u/Bas)\
**Post date:** [June 23, 2006, 8:19pm UTC](https://www.ruby-forum.com/t/to-yaml-problem-with-option-hash/64284/1 "2006-06-23T20:19:33Z")

</div>

Hi,

I’m trying to make a fixture for testing with a serialized column. In  
the YAML fixture I’m trying to fill the serialized column with the  
to\_yaml function. But I keep getting the ‘—’ separator, which I don’t  
want because it is only a ‘partial’ yaml fill.

According to the documentation to\_yaml takes a hash of options, so  
something like .to\_yaml( :Indent =\> 4, :Separator =\> ‘’). I’ve tried  
this but the option hash has no effect, the default stay in place.

Does anyone have an idea?  
Thank in advance, Bas

CODE example (test\_fixture.yml):

\<% hash\_small = { “0”=\>“1”, “1”=\>“2”, “2”=\>“3”, “3”=\>“4” } %\>

first:  
id: 1  
name: Test Hash  
data: \<%= hash\_small.to\_yaml( :Indent =\> 8, :Separator =\> ‘’) %\>  
datetime: \<%= datetime %\>
